[ 
https://issues.apache.org/jira/browse/BEAM-8015?focusedWorklogId=301534&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-301534
 ]

ASF GitHub Bot logged work on BEAM-8015:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Aug/19 21:40
            Start Date: 26/Aug/19 21:40
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on pull request #9389: [BEAM-8015] Get 
logs from Docker containers
URL: https://github.com/apache/beam/pull/9389#discussion_r317810869
 
 

 ##########
 File path: 
runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/environment/DockerEnvironmentFactory.java
 ##########
 @@ -152,34 +148,43 @@ public RemoteEnvironment createEnvironment(Environment 
environment) throws Excep
       containerId = docker.runImage(containerImage, dockerArgsBuilder.build(), 
args);
       LOG.debug("Created Docker Container with Container ID {}", containerId);
       // Wait on a client from the gRPC server.
-      while (instructionHandler == null) {
+      try {
+        instructionHandler = clientSource.take(workerId, 
Duration.ofMinutes(1));
+      } catch (TimeoutException timeoutEx) {
+        RuntimeException runtimeException =
+            new RuntimeException(
+                String.format(
+                    "Docker container %s failed to start up successfully 
within 1 minute.",
+                    containerImage),
+                timeoutEx);
         try {
-          instructionHandler = clientSource.take(workerId, 
Duration.ofMinutes(1));
-        } catch (TimeoutException timeoutEx) {
-          Preconditions.checkArgument(
-              docker.isContainerRunning(containerId), "No container running 
for id " + containerId);
-          LOG.info(
-              "Still waiting for startup of environment {} for worker id {}",
-              dockerPayload.getContainerImage(),
-              workerId);
-        } catch (InterruptedException interruptEx) {
-          Thread.currentThread().interrupt();
-          throw new RuntimeException(interruptEx);
+          String containerLogs = docker.getContainerLogs(containerId);
+          LOG.error("Docker container {} logs:\n{}", containerId, 
containerLogs);
 
 Review comment:
   (Also, I changed the code a bit, it was incorrect before)
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 301534)
    Time Spent: 2.5h  (was: 2h 20m)

> Get logs for SDK worker Docker containers
> -----------------------------------------
>
>                 Key: BEAM-8015
>                 URL: https://issues.apache.org/jira/browse/BEAM-8015
>             Project: Beam
>          Issue Type: Improvement
>          Components: java-fn-execution
>            Reporter: Kyle Weaver
>            Assignee: Kyle Weaver
>            Priority: Major
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Currently, when SDK worker containers fail to start up properly, an exception 
> is thrown that provides no information about what happened. We can improve 
> debugging by keeping containers around long enough to log their logs before 
> removing them.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to