You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/09/07 09:34:49 UTC

[GitHub] jiangpengcheng closed pull request #3999: Mark activationRun as failed if there is an ContainerConnectionError

jiangpengcheng closed pull request #3999: Mark activationRun as failed if there is an ContainerConnectionError
URL: https://github.com/apache/incubator-openwhisk/pull/3999
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/src/main/scala/whisk/core/containerpool/Container.scala b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
index dc59b3ce18..13c277faa8 100644
--- a/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
+++ b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
@@ -20,7 +20,7 @@ package whisk.core.containerpool
 import java.time.Instant
 
 import akka.actor.ActorSystem
-import akka.event.Logging.InfoLevel
+import akka.event.Logging.{ErrorLevel, InfoLevel}
 import akka.stream.scaladsl.Source
 import akka.util.ByteString
 import pureconfig._
@@ -100,12 +100,17 @@ trait Container {
     callContainer("/init", body, timeout, retry = true)
       .andThen { // never fails
         case Success(r: RunResult) =>
-          transid.finished(
-            this,
-            start.copy(start = r.interval.start),
-            s"initialization result: ${r.toBriefString}",
-            endTime = r.interval.end,
-            logLevel = InfoLevel)
+          r.response match {
+            case Left(_) =>
+              transid.failed(this, start, s"initialization failed with ${r.toBriefString}", logLevel = ErrorLevel)
+            case Right(_) =>
+              transid.finished(
+                this,
+                start.copy(start = r.interval.start),
+                s"initialization result: ${r.toBriefString}",
+                endTime = r.interval.end,
+                logLevel = InfoLevel)
+          }
         case Failure(t) =>
           transid.failed(this, start, s"initializiation failed with $t")
       }
@@ -142,12 +147,16 @@ trait Container {
     callContainer("/run", body, timeout, retry = false)
       .andThen { // never fails
         case Success(r: RunResult) =>
-          transid.finished(
-            this,
-            start.copy(start = r.interval.start),
-            s"running result: ${r.toBriefString}",
-            endTime = r.interval.end,
-            logLevel = InfoLevel)
+          r.response match {
+            case Left(_) => transid.failed(this, start, s"run failed with ${r.toBriefString}", logLevel = ErrorLevel)
+            case Right(_) =>
+              transid.finished(
+                this,
+                start.copy(start = r.interval.start),
+                s"running result: ${r.toBriefString}",
+                endTime = r.interval.end,
+                logLevel = InfoLevel)
+          }
         case Failure(t) =>
           transid.failed(this, start, s"run failed with $t")
       }
diff --git a/tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerTests.scala b/tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerTests.scala
index eb3b2ffed7..5d134b6c24 100644
--- a/tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerTests.scala
+++ b/tests/src/test/scala/whisk/core/containerpool/docker/test/DockerContainerTests.scala
@@ -430,7 +430,7 @@ class DockerContainerTests
 
     // assert the finish log is there
     val end = LogMarker.parse(logLines.last)
-    end.token shouldBe INVOKER_ACTIVATION_INIT.asFinish
+    end.token shouldBe INVOKER_ACTIVATION_INIT.asError
   }
 
   /*
@@ -479,7 +479,7 @@ class DockerContainerTests
 
     // assert the finish log is there
     val end = LogMarker.parse(logLines.last)
-    end.token shouldBe INVOKER_ACTIVATION_RUN.asFinish
+    end.token shouldBe INVOKER_ACTIVATION_RUN.asError
   }
 
   /*
diff --git a/tests/src/test/scala/whisk/core/containerpool/kubernetes/test/KubernetesContainerTests.scala b/tests/src/test/scala/whisk/core/containerpool/kubernetes/test/KubernetesContainerTests.scala
index 4214cf7ca6..63aa0107b3 100644
--- a/tests/src/test/scala/whisk/core/containerpool/kubernetes/test/KubernetesContainerTests.scala
+++ b/tests/src/test/scala/whisk/core/containerpool/kubernetes/test/KubernetesContainerTests.scala
@@ -245,7 +245,7 @@ class KubernetesContainerTests
 
     // assert the finish log is there
     val end = LogMarker.parse(logLines.last)
-    end.token shouldBe INVOKER_ACTIVATION_INIT.asFinish
+    end.token shouldBe INVOKER_ACTIVATION_INIT.asError
   }
 
   /*
@@ -292,7 +292,7 @@ class KubernetesContainerTests
 
     // assert the finish log is there
     val end = LogMarker.parse(logLines.last)
-    end.token shouldBe INVOKER_ACTIVATION_RUN.asFinish
+    end.token shouldBe INVOKER_ACTIVATION_RUN.asError
   }
 
   /*


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services