JobMetadata

class safir.arq.JobMetadata(id, name, args, kwargs, enqueue_time, status, queue_name)

Bases: object

Information about a queued job.

Parameters:

Attributes Summary

args

The positional arguments to the task function.

enqueue_time

Time when the job was added to the queue.

id

The Job identifier.

kwargs

The keyword arguments to the task function.

name

The task name.

queue_name

Name of the queue this job belongs to.

status

Status of the job.

Methods Summary

from_job(job)

Initialize JobMetadata from an arq Job.

Attributes Documentation

args: tuple[Any, ...] = <dataclasses._MISSING_TYPE object>

The positional arguments to the task function.

enqueue_time: datetime = <dataclasses._MISSING_TYPE object>

Time when the job was added to the queue.

id: str = <dataclasses._MISSING_TYPE object>

The Job identifier.

kwargs: dict[str, Any] = <dataclasses._MISSING_TYPE object>

The keyword arguments to the task function.

name: str = <dataclasses._MISSING_TYPE object>

The task name.

queue_name: str = <dataclasses._MISSING_TYPE object>

Name of the queue this job belongs to.

status: JobStatus = <dataclasses._MISSING_TYPE object>

Status of the job.

States are defined by the arq.jobs.JobStatus enumeration:

  • deferred (in queue, but waiting a predetermined time to become ready to run)

  • queued (queued to run)

  • in_progress (actively being run by a worker)

  • complete (result is available)

  • not_found (the job cannot be found)

Methods Documentation

async classmethod from_job(job)

Initialize JobMetadata from an arq Job.

Raises:

JobNotFound – Raised if the job is not found

Parameters:

job (Job)

Return type:

Self