Skip to content

Skip scheduling for empty cold creation. #5316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down