TraceInfo
Information about task execution.
Attributes
| Attribute | Type | Description |
|---|---|---|
| state | string | The current execution status of the task used to determine which error handling logic to apply. |
| retval | any = null | The return value or exception instance resulting from the task execution. |
Constructor
Signature
def TraceInfo(
state: Any,
retval: Any = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| state | Any | The current execution state of the task. |
| retval | Any = None | The return value or exception associated with the task state. |
Signature
def TraceInfo(
state: string,
retval: Any = null
)
Parameters
| Name | Type | Description |
|---|---|---|
| state | string | The current execution state of the task, such as RETRY or FAILURE |
| retval | Any = null | The return value or exception object associated with the task's current state |
Methods
handle_error_state()
@classmethod
def handle_error_state(
task: [Task](../../events/state/task.md?sid=celery_events_state_task),
req: [Request](../../worker/request/request.md?sid=celery_worker_request_request),
eager: boolean = false,
call_errbacks: boolean = true
) - > ExceptionInfo
Dispatches the task to the appropriate error handler based on the current state, determining whether errors should be persisted.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance being executed |
| req | [Request](../../worker/request/request.md?sid=celery_worker_request_request) | The request object containing task metadata and arguments |
| eager | boolean = false | Flag indicating if the task is being executed locally in the current process |
| call_errbacks | boolean = true | Whether to trigger error callbacks defined for the task |
Returns
| Type | Description |
|---|---|
ExceptionInfo | The exception information object generated by the specific state handler |
handle_reject()
@classmethod
def handle_reject(
task: [Task](../../events/state/task.md?sid=celery_events_state_task),
req: [Request](../../worker/request/request.md?sid=celery_worker_request_request)
)
Logs an error when a task is rejected by the worker.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance that was rejected |
| req | [Request](../../worker/request/request.md?sid=celery_worker_request_request) | The request object associated with the rejected task |
handle_ignore()
@classmethod
def handle_ignore(
task: [Task](../../events/state/task.md?sid=celery_events_state_task),
req: [Request](../../worker/request/request.md?sid=celery_worker_request_request)
)
Logs an error when a task execution is ignored.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance being ignored |
| req | [Request](../../worker/request/request.md?sid=celery_worker_request_request) | The request object associated with the ignored task |
handle_retry()
@classmethod
def handle_retry(
task: [Task](../../events/state/task.md?sid=celery_events_state_task),
req: [Request](../../worker/request/request.md?sid=celery_worker_request_request),
store_errors: boolean = true
) - > ExceptionInfo
Handle retry exception.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance requesting a retry |
| req | [Request](../../worker/request/request.md?sid=celery_worker_request_request) | The request object containing task identity and arguments |
| store_errors | boolean = true | Whether to update the result backend with the retry status |
Returns
| Type | Description |
|---|---|
ExceptionInfo | The exception information containing the retry reason and traceback |
handle_failure()
@classmethod
def handle_failure(
task: [Task](../../events/state/task.md?sid=celery_events_state_task),
req: [Request](../../worker/request/request.md?sid=celery_worker_request_request),
store_errors: boolean = true,
call_errbacks: boolean = true
) - > ExceptionInfo
Handle exception.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance that failed |
| req | [Request](../../worker/request/request.md?sid=celery_worker_request_request) | The request object associated with the failed task |
| store_errors | boolean = true | Whether to persist the failure state in the result backend |
| call_errbacks | boolean = true | Whether to execute the task's error callback functions |
Returns
| Type | Description |
|---|---|
ExceptionInfo | The exception information containing the pickleable exception and traceback |