Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-16303][rest] Enable retrieval of custom JobManager log files #11542

Closed
wants to merge 8 commits into from

Conversation

jerry-024
Copy link
Contributor

What is the purpose of the change

This pull request makes rest API could get log list and get the log by custom name for jobmanager.

Brief change log

  • get log list
  • get the log by name

Verifying this change

This change added tests and can be verified as follows:

  • Added JobManagerLogListHandlerTest that verfied JobManagerLogListHandler.
  • Added WebFrontendITCase.getCustomLogFiles could verfied JobManagerCustomLogHandler.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): ( no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no )
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (docs)

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 6c59031 (Fri Mar 27 04:26:19 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Mar 27, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@jerry-024
Copy link
Contributor Author

@flinkbot run travis

@GJL GJL self-assigned this Mar 27, 2020
@GJL
Copy link
Member

GJL commented Mar 31, 2020

For future reference, I think it would have been better to split this ticket into two:

  1. Implement JobManagerLogListHandler
  2. The rest

Separate commits also wouldn't hurt.

@jerry-024
Copy link
Contributor Author

For future reference, I think it would have been better to split this ticket into two:

  1. Implement JobManagerLogListHandler
  2. The rest

Separate commits also wouldn't hurt.

I don't agree to split this ticket into two.
The purpose of adding JobManagerLogListHandler is to allow the user to view the logs by custom.

@GJL
Copy link
Member

GJL commented Apr 1, 2020

I don't agree to split this ticket into two.
The purpose of adding JobManagerLogListHandler is to allow the user to view the logs by custom.

From my point of view, JobManagerLogListHandler lists the available log files. The ability to view the contents of the log files is a different story. Could we have implemented JobManagerLogListHandler independently from the other work in this PR? If yes, then I think we should have done it because it makes the review easier. For a Flink user it doesn't make a difference since the Web UI is not yet ready. I am not saying we should split the ticket now but for future tasks this is something to consider.

@jerry-024
Copy link
Contributor Author

I don't agree to split this ticket into two.
The purpose of adding JobManagerLogListHandler is to allow the user to view the logs by custom.

From my point of view, JobManagerLogListHandler lists the available log files. The ability to view the contents of the log files is a different story. Could we have implemented JobManagerLogListHandler independently from the other work in this PR? If yes, then I think we should have done it because it makes the review easier. For a Flink user it doesn't make a difference since the Web UI is not yet ready. I am not saying we should split the ticket now but for future tasks this is something to consider.

OK, I get your point. Thank you for your suggestion. I will pay attention to this later to make review easier.

…JobManagerLogListHandler, FileMessageParameters, JobManagerLogListHeaders
Copy link
Member

@GJL GJL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking mostly good. I have left some minor suggestions.


@Override
protected File getFile(HandlerRequest<EmptyRequestBody, EmptyMessageParameters> handlerRequest) {
return this.logFileLocation.stdOutFile;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it strange that JobManagerStdoutFileHandler also knows about the location of the regular log file (i.e., LogFileLocation#logFile). Moreover, we are introducing a class hierarchy without adding behavior, i.e., JobManagerStdoutFileHandler and JobManagerLogFileHandler are doing the same thing (serving a (log) file).

I would propose to drop JobManagerStdoutFileHandler and add a File field to JobManagerLogFileHandler.
JobManagerCustomLogHandler should have a log dir field.

What do you think?

@jerry-024 jerry-024 requested a review from GJL April 9, 2020 01:23
@GJL
Copy link
Member

GJL commented Apr 13, 2020

image

Can we create a new issue for the Web UI to recreate this behavior? After this PR nothing will be shown if no log file is configured.

cc: @vthinkxie

LogInfo logInfo = logInfo2Content.getKey();
String content = logInfo2Content.getValue();
File file = temporaryFolder.newFile(logInfo.getName());
FileUtils.writeStringToFile(file, content);
Copy link
Member

@GJL GJL Apr 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure that the file is UTF-8 or ASCII encoded otherwise we risk that one ASCII character is not one byte. writeStringToFile uses the system's default character set. I fixed it before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you.
I find the same code in WebFrontendITCase, whether need we to fix them?

@vthinkxie
Copy link
Contributor

vthinkxie commented Apr 16, 2020

image

Can we create a new issue for the Web UI to recreate this behavior? After this PR nothing will be shown if no log file is configured.

cc: @vthinkxie

adding the tips with (file unavailable) in the frontend code? I'm ok with this.

jrthe42 added a commit to jrthe42/flink that referenced this pull request May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants