mainframe.endpoints.job

Attributes

Functions

get_jobs(], auth, Depends], state, Depends], batch)

Request one or more releases to work on.

Module Contents

mainframe.endpoints.job.router[source]
mainframe.endpoints.job.logger: structlog.stdlib.BoundLogger[source]
mainframe.endpoints.job.get_jobs(session: Annotated[sqlalchemy.orm.Session, Depends(get_db)], auth: Annotated[mainframe.json_web_token.AuthenticationData, Depends(validate_token)], state: Annotated[mainframe.rules.Rules, Depends(get_rules)], batch: int = 1) list[mainframe.models.schemas.JobResult][source]

Request one or more releases to work on.

Clients can specify the number of jobs they want to be given using the batch query string parameter. If omitted, it defaults to 1.

Clients are assigned the oldest release in the queue, i.e., the release with the oldest queued_at time.

We also consider releases with a pending_at older than now() - JOB_TIMEOUT to be queued at the current time. This way, timed out packages are always processed after newly queued packages.