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
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 6c59031 (Fri Mar 27 04:26:19 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
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 commandsThe @flinkbot bot supports the following commands:
|
@flinkbot run travis |
.../src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerCustomLogHandler.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandler.java
Outdated
Show resolved
Hide resolved
…ler,JobManagerLogListHandler
…ler,JobManagerLogListHandler
...me/src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandler.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
For future reference, I think it would have been better to split this ticket into two:
Separate commits also wouldn't hurt. |
I don't agree to split this ticket into two. |
From my point of view, |
OK, I get your point. Thank you for your suggestion. I will pay attention to this later to make review easier. |
...e/src/main/java/org/apache/flink/runtime/rest/messages/cluster/JobManagerLogListHeaders.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpoint.java
Show resolved
Hide resolved
...time/src/main/java/org/apache/flink/runtime/rest/messages/cluster/FileMessageParameters.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/runtime/rest/handler/cluster/AbstractJobManagerFileHandler.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandler.java
Show resolved
Hide resolved
...c/main/java/org/apache/flink/runtime/rest/handler/cluster/AbstractJobManagerFileHandler.java
Outdated
Show resolved
Hide resolved
…JobManagerLogListHandler, FileMessageParameters, JobManagerLogListHeaders
There was a problem hiding this 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.
...c/main/java/org/apache/flink/runtime/rest/handler/cluster/AbstractJobManagerFileHandler.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
protected File getFile(HandlerRequest<EmptyRequestBody, EmptyMessageParameters> handlerRequest) { | ||
return this.logFileLocation.stdOutFile; |
There was a problem hiding this comment.
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?
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpoint.java
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandler.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerCustomLogHandler.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerCustomLogHandler.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/runtime/rest/handler/cluster/JobManagerLogListHandlerTest.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/runtime/rest/handler/cluster/AbstractJobManagerFileHandler.java
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
Outdated
Show resolved
Hide resolved
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
adding the tips with (file unavailable) in the frontend code? I'm ok with this. |
…r log files This closes apache#11542.
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
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation