saq.types

Types

Module Contents

class saq.types.Context[source]

Bases: typing_extensions.TypedDict

Task context.

Extra context fields are allowed.

worker: typing_extensions.Required[saq.worker.Worker][source]

Worker currently executing the task

job: saq.job.Job[source]

Job() instance of the task

queue: saq.queue.Queue[source]

Queue the task is running on

exception: Exception | None[source]

Exception raised by the task if any

class saq.types.JobTaskContext[source]

Bases: typing_extensions.TypedDict

Jobs Task Context

task: asyncio.Task[Any][source]

asyncio Task of the Job

aborted: str | None[source]

If this task has been aborted, this is the reason

class saq.types.WorkerInfo[source]

Bases: typing_extensions.TypedDict

Worker Info

class saq.types.QueueInfo[source]

Bases: typing_extensions.TypedDict

Queue Info

workers: dict[str, WorkerInfo][source]

Worker information

name: str[source]

Queue name

queued: int[source]

Number of jobs currently in the queue

active: int[source]

Number of jobs currently active

jobs: list[dict[str, Any]][source]

A truncated list containing the jobs that are scheduled to execute soonest

class saq.types.WorkerStats[source]

Bases: typing_extensions.TypedDict

Worker Stats

complete: int[source]

Number of complete tasks

failed: int[source]

Number of failed tasks

retried: int[source]

Number of retries

aborted: int[source]

Number of aborted tasks

uptime: int[source]

Queue uptime in milliseconds

class saq.types.TimersDict[source]

Bases: typing_extensions.TypedDict

Timers Dictionary

schedule: int[source]

How often we poll to schedule jobs in seconds (default 1)

worker_info: int[source]

How often to update worker info, stats and metadata in seconds (default 10)

sweep: int[source]

How often to clean up stuck jobs in seconds (default 60)

abort: int[source]

How often to check if a job is aborted in seconds (default 1)

class saq.types.PartialTimersDict[source]

Bases: TimersDict

For argument to Worker, all keys are not required

class saq.types.SettingsDict[source]

Bases: typing_extensions.TypedDict

Settings