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
| Attribute | Type | Description |
|---|---|---|
| name | string | The registered name of the Celery task. |
| args | bytes | Binary representation of the positional arguments passed to the task. |
| kwargs | bytes | Binary representation of the keyword arguments passed to the task. |
| worker | string | The identifier of the worker instance that executed the task. |
| retries | integer | The number of times the task has been retried after failure. |
| queue | string | The 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
| Type | Description |
|---|---|
dict | A dictionary containing the combined core and extended task attributes, including name, args, kwargs, worker, retries, and queue information. |