ProcessContext#

class controller.factory.ProcessContext(config, http_client, kubernetes_client, image_service, prepuller, lab_manager, _fileserver_manager, background)#

Bases: object

Per-process global application state.

This object holds all of the per-process singletons and is managed by ContextDependency. It is used by the Factory class as a source of dependencies to inject into created service and storage objects, and by the context dependency as a source of singletons that should also be exposed to route handlers via the request context.

Parameters:

Attributes Summary

background

Manager for background tasks.

config

Lab controller configuration.

fileserver_manager

File server manager, if file servers are configured.

http_client

Shared HTTP client.

image_service

Image service.

kubernetes_client

Shared Kubernetes client.

lab_manager

State management for user lab pods.

prepuller

Prepuller.

Methods Summary

aclose()

Free allocated resources.

from_config(config)

Create a new process context from the controller configuration.

start()

Start the background threads running.

stop()

Clean up a process context.

Attributes Documentation

background: BackgroundTaskManager#

Manager for background tasks.

config: Config#

Lab controller configuration.

fileserver_manager#

File server manager, if file servers are configured.

http_client: AsyncClient#

Shared HTTP client.

image_service: ImageService#

Image service.

kubernetes_client: ApiClient#

Shared Kubernetes client.

lab_manager: LabManager#

State management for user lab pods.

prepuller: Prepuller#

Prepuller.

Methods Documentation

async aclose()#

Free allocated resources. :rtype: None

async classmethod from_config(config)#

Create a new process context from the controller configuration.

Parameters:

config (Config) – Lab controller configuration.

Returns:

Shared context for a lab controller process.

Return type:

ProcessContext

async start()#

Start the background threads running. :rtype: None

async stop()#

Clean up a process context.

Called during shutdown, or before recreating the process context using a different configuration. :rtype: None