chetanmeh 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_r163150842
##########
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:
Much simpler! I was trying to unnecessarily use `Try` where good old `try`
would have been better.
Update - [Try][1] docs state that it catches only [non fatal][2] error. With
this use of Throwable we may be also catching Fatal errors
[1]: http://www.scala-lang.org/api/2.12.3/scala/util/Try.html
[2]: http://www.scala-lang.org/api/2.12.3/scala/util/control/NonFatal$.html
----------------------------------------------------------------
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