This is an automated email from the ASF dual-hosted git repository.
style95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 9be427c72 Skip scheduling for empty cold creation. (#5316)
9be427c72 is described below
commit 9be427c72680035e852496440a5a8ce4113424c4
Author: Dominic Kim <[email protected]>
AuthorDate: Wed Aug 24 18:20:53 2022 +0900
Skip scheduling for empty cold creation. (#5316)
---
.../scheduler/container/ContainerManager.scala | 28 ++++++++++++----------
.../container/test/ContainerManagerTests.scala | 2 +-
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git
a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala
b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala
index 038dbe09c..050f4c8ad 100644
---
a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala
+++
b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala
@@ -181,20 +181,22 @@ class ContainerManager(jobManagerFactory: ActorRefFactory
=> ActorRef,
}
// handle cold creations
- ContainerManager
- .schedule(updatedInvokers, coldCreations.map(_._1), memory)
- .map { pair =>
- pair.invokerId match {
- // an invoker is assigned for the msg
- case Some(instanceId) =>
- creationJobManager ! RegisterCreationJob(pair.msg)
- sendCreationContainerToInvoker(messagingProducer,
instanceId.instance, pair.msg)
-
- // if a chosen invoker does not exist, it means it failed to
find a matching invoker for the msg.
- case _ =>
- pair.err.foreach(error => sendState(pair.msg, error, error))
+ if (coldCreations.nonEmpty) {
+ ContainerManager
+ .schedule(updatedInvokers, coldCreations.map(_._1), memory)
+ .map { pair =>
+ pair.invokerId match {
+ // an invoker is assigned for the msg
+ case Some(instanceId) =>
+ creationJobManager ! RegisterCreationJob(pair.msg)
+ sendCreationContainerToInvoker(messagingProducer,
instanceId.instance, pair.msg)
+
+ // if a chosen invoker does not exist, it means it failed to
find a matching invoker for the msg.
+ case _ =>
+ pair.err.foreach(error => sendState(pair.msg, error,
error))
+ }
}
- }
+ }
}
}
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/scheduler/container/test/ContainerManagerTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/scheduler/container/test/ContainerManagerTests.scala
index d1f43270b..1474cbdda 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/scheduler/container/test/ContainerManagerTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/scheduler/container/test/ContainerManagerTests.scala
@@ -136,7 +136,7 @@ class ContainerManagerTests
def mockMessaging(receiver: Option[ActorRef] = None): MessagingProvider = {
val messaging = stub[MessagingProvider]
- val producer =
receiver.map(fakeProducer(_)).getOrElse(stub[MessageProducer])
+ val producer = receiver.map(fakeProducer).getOrElse(stub[MessageProducer])
val consumer = stub[MessageConsumer]
(messaging
.getProducer(_: WhiskConfig, _: Option[ByteSize])(_: Logging, _:
ActorSystem))