Skip to content

[BEAM-8015] Get logs from Docker containers#9389

Merged
mxm merged 1 commit intoapache:masterfrom
ibzib:docker-logs
Aug 27, 2019
Merged

[BEAM-8015] Get logs from Docker containers#9389
mxm merged 1 commit intoapache:masterfrom
ibzib:docker-logs

Conversation

@ibzib
Copy link

@ibzib ibzib commented Aug 21, 2019

  • Log Docker output both when the container fails to start up, and when it is closed normally.
  • In order to get logs for stopped (failed) containers, don't use the rm option for docker run, which deletes containers before we can inspect what happened to them. Instead, call docker rm ourselves to clean up the container only after we log its logs. (Behavior for --retain_docker_container stays the same.)
  • Remove a bit of dead code in Docker container startup.

Apologies for complicating the test setup -- I wanted to parameterize to make sure we're covering all the cases.

R: @angoenka @mxm

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status --- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@ibzib
Copy link
Author

ibzib commented Aug 21, 2019

Run Java PreCommit

3 similar comments
@ibzib
Copy link
Author

ibzib commented Aug 21, 2019

Run Java PreCommit

@ibzib
Copy link
Author

ibzib commented Aug 21, 2019

Run Java PreCommit

@ibzib
Copy link
Author

ibzib commented Aug 21, 2019

Run Java PreCommit

Copy link
Contributor

@mxm mxm left a comment

Choose a reason for hiding this comment

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

That will be very helpful for debugging container problems.

@ibzib ibzib force-pushed the docker-logs branch 2 times, most recently from 96c0051 to 8c285a6 Compare August 22, 2019 17:53
@ibzib
Copy link
Author

ibzib commented Aug 22, 2019

Run Java PreCommit

Thread.currentThread().interrupt();
throw new RuntimeException(interruptEx);
String containerLogs = docker.getContainerLogs(containerId);
LOG.error("Docker container {} logs:\n{}", containerId, containerLogs);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only print "redirected to stdout" now?

Copy link
Author

Choose a reason for hiding this comment

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

No, see my other comment

Copy link
Author

Choose a reason for hiding this comment

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

(Also, I changed the code a bit, it was incorrect before)

return reader.lines().collect(Collectors.joining());
return reader.lines().collect(Collectors.joining(delimiter));
});
CompletableFuture<String> errorFuture;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't a better place for this and all following lines to be in the

if (exitCode != 0) {

block? The errorFuture and errorString are not used elsewhere.

@mxm
Copy link
Contributor

mxm commented Aug 27, 2019

Run Java PreCommit

@mxm mxm merged commit 514cf21 into apache:master Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants