ContextDependency#

class controller.dependencies.context.ContextDependency#

Bases: object

Provide a per-request context as a FastAPI dependency.

Each request gets its own RequestContext. The portions of the context shared across all requests are collected into the single process-global ProcessContext and reused with each request.

Attributes Summary

is_initialized

Whether the process context has been initialized.

Methods Summary

__call__(request, logger)

Create a per-request context and return it.

aclose()

Clean up the per-process configuration.

initialize(config)

Initialize the process-global shared context.

Attributes Documentation

is_initialized#

Whether the process context has been initialized.

Methods Documentation

async __call__(request, logger)#

Create a per-request context and return it.

Parameters:
Return type:

RequestContext

async aclose()#

Clean up the per-process configuration. :rtype: None

async initialize(config)#

Initialize the process-global shared context.

Parameters:

config (Config) – Config for the lab controller.

Return type:

None