Skip to main content

TaskExtended

This class extends the standard task metadata model to store additional execution details in the database. It captures specific task attributes such as arguments, keyword arguments, worker identity, retry counts, and queue names. The class also provides a method to serialize these extended attributes into a dictionary format.

Attributes

AttributeTypeDescription
namestringThe registered name of the Celery task.
argsbytesBinary representation of the positional arguments passed to the task.
kwargsbytesBinary representation of the keyword arguments passed to the task.
workerstringThe identifier of the worker instance that executed the task.
retriesintegerThe number of times the task has been retried after failure.
queuestringThe name of the message broker queue where the task was routed.

Methods


to_dict()

@classmethod
def to_dict() - > dict

Converts the task instance into a dictionary representation, extending the base task data with additional metadata such as arguments, worker details, and retry counts.

Returns

TypeDescription
dictA dictionary containing the combined core and extended task attributes, including name, args, kwargs, worker, retries, and queue information.