Skip to content

Reference

CeleryTaskModel

Attributes

async_result property

async_result: AsyncResult | None

Return the AsyncResult object of the current instance.

celery_task_queue class-attribute instance-attribute

celery_task_queue: str = CELERY_TASK_DEFAULT_QUEUE

Name of the queue this task connected to. Only need to be specified if different from settings.CELERY_TASK_DEFAULT_QUEUE

celery_task_revoked_queue class-attribute instance-attribute

celery_task_revoked_queue: str = CELERY_TASK_REVOKED_QUEUE

Name of the queue where revoked tasks are stored. Only need to be specified if different from settings.CELERY_TASK_REVOKED_QUEUE

default_celery_task_name class-attribute instance-attribute

default_celery_task_name: str = ''

FQN of the task processing this Model's instances

queue_entry property

queue_entry: dict[str, Any]

Return the queue entry of the current instance.

queue_position property

queue_position: int

Return the position of the current task in the queue.

Returns:

Type Description
int

int task position in queue

task_info property

task_info: dict[str, Any]

Return the task meta information of the current instance.

Returns:

Type Description
dict[str, Any]

Dictionary with task information

task_status property

task_status: str

Return the task status querying Celery API.

Functions

celery_queue_info classmethod

celery_queue_info() -> dict[str, int]

Return information about the queue.

Returns:

Type Description
dict[str, int]

Dictionary with size,pending, canceled, revoked tasks

is_queued

is_queued() -> bool

Check if the job is queued.

is_terminated

is_terminated() -> bool

Check if the job is queued.

queue

queue(use_version: bool = True) -> str | None

Queue the record processing.

use_version: if True the task fails if the record is changed after it has been queued.

task_handler

task_handler() -> Callable[[Any], Any]

Return the task assigned to this model.

terminate

terminate(wait=False, timeout=None) -> str

Revoke the task. Does not need Running workers.