betty.job module

Provide utilities for running jobs concurrently.

class betty.job.Context[source]

Bases: object

Define a job context.

Parameters:

localizer (betty.locale.Localizer | None)

__init__(localizer: betty.locale.Localizer | None = None)[source]
Parameters:

localizer (betty.locale.Localizer | None)

property cache: Cache[Any]

Provide a cache for this job context.

The cache is volatile and will be discarded once the job context is completed.

claim(job_id: str) bool[source]

Claim a job within this context.

Parameters:

job_id (str)

Return type:

bool

property start: datetime

When the job started.