markusthoemmes commented on a change in pull request #2795: enable concurrent
activation processing
URL:
https://github.com/apache/incubator-openwhisk/pull/2795#discussion_r193960937
##########
File path:
core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
##########
@@ -205,10 +213,35 @@ class ContainerProxy(
// and we keep it in case we need to destroy it.
case Event(data: PreWarmedData, _) => stay using data
- // Run was successful
- case Event(data: WarmedData, _) =>
+ // Init was successful
+ case Event(data: WarmedData, _: PreWarmedData) =>
+ //in case concurrency supported, multiple runs can begin as soon as init
is complete
context.parent ! NeedWork(data)
- goto(Ready) using data
+ stay using data
+
+ // Run was successful
+ case Event(_: WarmedData, s: WarmedData) =>
+ val newData = s.decrementActive
+
+ context.parent ! NeedWork(newData)
+
+ if (newData.activeActivationCount > 0) {
+ stay using newData
+ } else {
+ logging.info(this, "going to ready after load completed")
+ goto(Ready) using newData
+ }
+
+ case Event(job: Run, data: WarmedData)
+ if stateData.activeActivationCount < poolConfig.maxConcurrent &&
!rescheduleJob => //if there was a delay, or a failure on resume, skip the run
+
+ implicit val transid = job.msg.transid
+ val newData = data.incrementActive
+
+ initializeAndRun(data.container, job)
+ .map(_ => WarmedData(data.container, job.msg.user.namespace,
job.action, Instant.now))
Review comment:
Agreed.
----------------------------------------------------------------
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