markusthoemmes commented on a change in pull request #2878: Streamingly read
user-logs.
URL:
https://github.com/apache/incubator-openwhisk/pull/2878#discussion_r153008723
##########
File path:
common/scala/src/main/scala/whisk/core/containerpool/logging/DockerLogStore.scala
##########
@@ -43,7 +69,22 @@ class DockerLogStore(system: ActorSystem) extends LogStore {
override def collectLogs(transid: TransactionId,
container: Container,
action: ExecutableWhiskAction):
Future[ActivationLogs] = {
- container.logs(action.limits.logs.asMegaBytes,
action.exec.sentinelledLogs)(transid).map(ActivationLogs(_))
+
+ val possibleErrors = Set(Messages.logFailure,
Messages.truncateLogs(action.limits.logs.asMegaBytes))
+
+ container
+ .logs(action.limits.logs.asMegaBytes,
action.exec.sentinelledLogs)(transid)
+ .via(DockerLogStore.toFormattedString)
+ .runWith(Sink.seq)
+ .flatMap { seq =>
+ val errored = seq.lastOption.exists(last =>
possibleErrors.exists(last.contains))
+ val logs = ActivationLogs(seq.toVector)
+ if (!errored) {
+ Future.successful(logs)
Review comment:
Note the function is already returning a Future, this just makes it a bit
more granular.
----------------------------------------------------------------
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