rabbah commented on a change in pull request #2878: Streamingly read user-logs.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2878#discussion_r152986174
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
 ##########
 @@ -371,18 +369,28 @@ class ContainerProxy(factory: (TransactionId, String, 
ImageName, Boolean, ByteSi
         case Success(ack) => sendActiveAck(tid, ack, job.msg.blocking, 
job.msg.rootControllerIndex)
       }
       .flatMap { activation =>
-        collectLogs(tid, container, job.action).map { logs =>
-          activation.withLogs(logs)
-        }
-      }
-      .andThen {
-        case Success(activation) => storeActivation(tid, activation)
-      }
-      .flatMap { activation =>
-        // Fail the future iff the activation was unsuccessful to facilitate
-        // better cleanup logic.
-        if (activation.response.isSuccess) Future.successful(activation)
-        else Future.failed(ActivationUnsuccessfulError(activation))
+        val start = tid.started(this, LoggingMarkers.INVOKER_COLLECT_LOGS)
+        collectLogs(tid, container, job.action)
+          .recoverWith {
+            case t =>
+              tid.failed(this, start, s"reading logs failed: $t")
+              val withLogs = t match {
+                case LogCollectingException(logs) => activation.withLogs(logs)
+                case _                            => 
activation.withLogs(ActivationLogs(Vector(Messages.logFailure)))
+              }
+              storeActivation(tid, withLogs)
 
 Review comment:
   why are there two storeActivation calls? here and for the flatmap below.

----------------------------------------------------------------
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