src.admin.jobs

Module Contents

class src.admin.jobs.QueuedJob
run_id: int
endpoint: str
payload: dict[str, Any]
src.admin.jobs.JOB_QUEUE: collections.deque[QueuedJob]
src.admin.jobs.QUEUE_CONDITION
src.admin.jobs.DISPATCHER_THREAD: threading.Thread | None = None
src.admin.jobs.DISPATCHER_LOCK
src.admin.jobs.CURRENT_PROCESS: multiprocessing.Process | None = None
src.admin.jobs.CURRENT_RUN_ID: int | None = None
src.admin.jobs.PROCESS_LOCK
src.admin.jobs.UNEXPECTED_EXIT_MESSAGE = 'Job process exited unexpectedly before the run could finish.'
src.admin.jobs.RESTART_EXIT_MESSAGE = 'Run was interrupted because the server stopped before the job could finish.'
src.admin.jobs.RESTART_QUEUE_MESSAGE = 'Run was interrupted because the server stopped before the queued job could start.'
src.admin.jobs.CANCEL_GRACE_SECONDS = 10.0
src.admin.jobs.reconcile_interrupted_runs() int
src.admin.jobs.enqueue_run(run_id: int, endpoint: str, payload: dict[str, Any]) None

Enqueue a run job and notify the dispatcher.

Parameters:
  • run_id (int) – Unique run identifier. endpoint (str): Target endpoint. payload (dict[str,

  • Any]) – Job payload.

Returns:

This function does not return a value.

Return type:

None

src.admin.jobs.request_run_cancellation(run_id: int) str

Cancel a queued or running run by ID. :param run_id: Identifier of the run to cancel. :type run_id: int

Returns:

Resulting run status, typically “cancelled”, “running”, or the existing status.

Return type:

str