BackgroundTaskManager¶
- class controller.background.BackgroundTaskManager(*, image_service, prepuller, lab_manager, fileserver_manager, slack_client, logger)¶
Bases:
object
Manage Nublado controller background tasks.
While the Nublado controller is running, it needs to perform several periodic or continuous background tasks, namely:
Refresh the list of available remote images and local cached images.
Prepull images to all eligible nodes.
Reconcile Kubernetes lab state with internal data structures.
Reap tasks that were monitoring lab spawning or deletion.
Watch file servers for changes in pod status (startup or timeout).
Reconcile Kubernetes file server state with internal data structures.
This class manages all of these background tasks including, where relevant, their schedules. It only does the task management; all of the work of these tasks is done by methods on the underlying service objects.
This class is created during startup and tracked as part of the
ProcessContext
.- Parameters:
image_service (
ImageService
) – Image service.prepuller (
Prepuller
) – Prepuller service.lab_manager (
LabManager
) – Lab management service.fileserver_manager (
FileserverManager
|None
) – File server management service.slack_client (
SlackWebhookClient
|None
) – Optional Slack webhook client for alerts.logger (
BoundLogger
) – Logger to use.
Methods Summary
start
()Start all background tasks.
stop
()Stop the background tasks.
Methods Documentation
- async start()¶
Start all background tasks.
Intended to be called during Nublado controller startup. Several of the background tasks are run in the foreground first to ensure internal state is valid before starting to serve requests.
- Return type: