Prepuller#

class controller.services.prepuller.Prepuller(*, image_service, prepuller_builder, metadata_storage, pod_storage, slack_client=None, logger)#

Bases: object

Prepull images to Kubernetes nodes.

There should be a singleton of this class in the lab controller process. It runs as a background task, prepulling images to nodes based on the information gathered by ImageService.

Parameters:
  • image_service (ImageService) – Service to query for image information. Currently, the background refresh thread of the image service is also managed by this class.

  • prepuller_builder (PrepullerBuilder) – Service that constructs prepuller Kubernetes objects.

  • metadata_storage (MetadataStorage) – Storage layer for Nublado controller pod metadata.

  • pod_storage (PodStorage) – Storage layer for managing Kubernetes pods.

  • slack_client (Optional[SlackWebhookClient], default: None) – Optional Slack webhook client for alerts.

  • logger (BoundLogger) – Logger for messages.

Methods Summary

prepull_images()

Prepull missing images.

start()

Start the prepuller.

stop()

Stop the prepuller.

Methods Documentation

async prepull_images()#

Prepull missing images.

Return type:

None

async start()#

Start the prepuller.

The prepuller normally runs for the lifetime of the process in the background, but when first called, wait for the image data to populate in the foreground. This ensures that we populate image data before FastAPI completes its startup event, and therefore before we start answering requests. That in turn means a more accurate health check, since until we have populated image data our API is fairly useless. (It also makes life easier for the test suite.)

Return type:

None

async stop()#

Stop the prepuller.

Return type:

None