RedisArqQueue¶
- class safir.arq.RedisArqQueue(pool: ArqRedis, *, default_queue_name: str = 'arq:queue')¶
Bases:
ArqQueue
A distributed queue, based on arq and Redis.
Methods Summary
enqueue
(task_name, *task_args[, _queue_name])Add a job to the queue.
get_job_metadata
(job_id[, queue_name])Get metadata about a
Job
.get_job_result
(job_id[, queue_name])The job result, if available.
initialize
(redis_settings, *[, ...])Initialize a RedisArqQueue from Redis settings.
Methods Documentation
- async enqueue(task_name: str, *task_args: Any, _queue_name: Optional[str] = None, **task_kwargs: Any) JobMetadata ¶
Add a job to the queue.
- Parameters:
- Returns:
Metadata about the queued job.
- Return type:
- Raises:
JobNotQueued – Raised if the job is not successfully added to the queue.
- async get_job_metadata(job_id: str, queue_name: Optional[str] = None) JobMetadata ¶
Get metadata about a
Job
.- Parameters:
job_id (
str
) – The job’s identifier. This is the same as theJobMetadata.id
attribute, provided when initially adding a job to the queue.queue_name (
str
, optional) – Name of the queue.
- Returns:
Metadata about the queued job.
- Return type:
- Raises:
JobNotFound – Raised if the job is not found in the queue.
- async get_job_result(job_id: str, queue_name: Optional[str] = None) JobResult ¶
The job result, if available.
- Parameters:
job_id (
str
) – The job’s identifier. This is the same as theJobMetadata.id
attribute, provided when initially adding a job to the queue.queue_name (
str
, optional) – Name of the queue.
- Returns:
The job’s result, along with metadata about the queued job.
- Return type:
- Raises:
JobNotFound – Raised if the job is not found in the queue.
JobResultUnavailable – Raised if the job’s result is unavailable for any reason.
- async classmethod initialize(redis_settings: RedisSettings, *, default_queue_name: str = 'arq:queue') RedisArqQueue ¶
Initialize a RedisArqQueue from Redis settings.