Task
Task result/status.
Attributes
| Attribute | Type | Description |
|---|---|---|
| id | integer | Primary key identifier for the task record, utilizing a dialect-specific integer sequence. |
| task_id | string | Unique string identifier for the specific Celery task instance. |
| status | string = PENDING | Current execution state of the task, such as PENDING or SUCCESS. |
| result | PickleType | The pickled return value or exception object produced by the task execution. |
| date_done | datetime = _get_utc_now | The UTC timestamp indicating when the task reached a terminal state. |
| traceback | text | The full string representation of the stack trace if the task failed. |
Constructor
Signature
def Task(
task_id: string
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| task_id | string | The unique identifier for the task. |
Signature
def Task(
task_id: string
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| task_id | string | The unique string identifier for the Celery task to be tracked. |
Methods
to_dict()
@classmethod
def to_dict() - > object
Converts the task metadata into a dictionary format suitable for serialization.
Returns
| Type | Description |
|---|---|
object | A dictionary containing the task_id, status, result, traceback, and completion date. |
configure()
@classmethod
def configure(
schema: string,
name: string
) - > null
Configures the database schema and table name for the Task model at runtime.
Parameters
| Name | Type | Description |
|---|---|---|
| schema | string | The database schema name where the task metadata table should reside. |
| name | string | An optional override for the database table name; defaults to 'celery_taskmeta'. |
Returns
| Type | Description |
|---|---|
null | None |