Skip to content

Exclude warmed containers in disabled invokers. #5313

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 5 commits into from
Aug 22, 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 @@ -636,6 +636,23 @@ object ContainerMessage extends DefaultJsonProtocol {
sealed trait ContainerCreationError

object ContainerCreationError extends Enumeration {
import scala.language.implicitConversions
implicit def containerCreationErrorToString(x: ContainerCreationError): String = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x match {
case NoAvailableInvokersError => "no available invoker is found"
case NoAvailableResourceInvokersError => "no available invoker with the resources is found: "
case ResourceNotEnoughError => "invoker(s) have not enough resources"
case WhiskError => "whisk error(recoverable) happens"
case UnknownError => "a unknown error happens"
case TimeoutError => "a timeout error happens"
case ShuttingDownError => "shutting down error happens"
case NonExecutableActionError => "no executable found for the action"
case DBFetchError => "an error happens while fetching data from DB"
case BlackBoxError => "a blackbox error happens"
case ZeroNamespaceLimit => "the namespace has 0 limit configured"
case TooManyConcurrentRequests => "too many concurrent requests are in flight."
}
}

case object NoAvailableInvokersError extends ContainerCreationError

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,34 +376,20 @@ class FPCInvokerReactive(config: WhiskConfig,
override def enable(): Route = {
invokerHealthManager ! Enable
pool ! Enable
// re-enable consumer
if (consumer.isEmpty)
consumer = Some(
new ContainerMessageConsumer(
instance,
pool,
entityStore,
cfg,
msgProvider,
longPollDuration = 1.second,
maxPeek,
sendAckToScheduler))
warmUp()
complete("Success enable invoker")
}

override def disable(): Route = {
invokerHealthManager ! GracefulShutdown
pool ! GracefulShutdown
consumer.foreach(_.close())
consumer = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the invoker is disabled, it handles messages that may come in for a while. 👍

warmUpWatcher.foreach(_.close())
warmUpWatcher = None
complete("Successfully disabled invoker")
}

override def isEnabled(): Route = {
complete(InvokerEnabled(consumer.nonEmpty && warmUpWatcher.nonEmpty).serialize())
complete(InvokerEnabled(warmUpWatcher.nonEmpty).serialize())
}

override def backfillPrewarm(): Route = {
Expand Down
Loading