markusthoemmes commented on a change in pull request #3196: Fixes #3195 - 
create config object for docker in the invoker and get ?
URL: 
https://github.com/apache/incubator-openwhisk/pull/3196#discussion_r163149964
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
 ##########
 @@ -380,18 +382,25 @@ class ContainerProxy(
     val activationWithLogs: Future[Either[ActivationLogReadingError, 
WhiskActivation]] = activation
       .flatMap { activation =>
         val start = tid.started(this, LoggingMarkers.INVOKER_COLLECT_LOGS)
-        collectLogs(tid, job.msg.user, activation, container, job.action)
-          .andThen {
-            case Success(_) => tid.finished(this, start)
-            case Failure(t) => tid.failed(this, start, s"reading logs failed: 
$t")
-          }
-          .map(logs => Right(activation.withLogs(logs)))
-          .recover {
-            case LogCollectingException(logs) =>
-              Left(ActivationLogReadingError(activation.withLogs(logs)))
-            case _ =>
-              
Left(ActivationLogReadingError(activation.withLogs(ActivationLogs(Vector(Messages.logFailure)))))
-          }
+        Try(
+          collectLogs(tid, job.msg.user, activation, container, job.action)
+            .andThen {
+              case Success(_) => tid.finished(this, start)
+              case Failure(t) => tid.failed(this, start, s"reading logs 
failed: $t")
+            }
+            .map(logs => Right(activation.withLogs(logs)))
+            .recover {
+              case LogCollectingException(logs) =>
+                Left(ActivationLogReadingError(activation.withLogs(logs)))
+              case _ =>
+                
Left(ActivationLogReadingError(activation.withLogs(ActivationLogs(Vector(Messages.logFailure)))))
 
 Review comment:
   Here it comes, I propose the following diff for this file to narrow down the 
exception handling:
   
   ```diff
   diff --git 
a/core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala 
b/core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
   index 23d09651..93399069 100644
   --- 
a/core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
   +++ 
b/core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
   @@ -380,7 +380,11 @@ class ContainerProxy(
        val activationWithLogs: Future[Either[ActivationLogReadingError, 
WhiskActivation]] = activation
          .flatMap { activation =>
            val start = tid.started(this, LoggingMarkers.INVOKER_COLLECT_LOGS)
   -        collectLogs(tid, job.msg.user, activation, container, job.action)
   +        val collected: Future[ActivationLogs] = try {
   +          collectLogs(tid, job.msg.user, activation, container, job.action)
   +        } catch { case t: Throwable => Future.failed(t) }
   +
   +        collected
              .andThen {
                case Success(_) => tid.finished(this, start)
                case Failure(t) => tid.failed(this, start, s"reading logs 
failed: $t")
   
   ```
   
   It transforms a failure in `collectLogs` to a failed Future, so we can 
process it as is. WDYT?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to