This document describes the current stable version of Celery (4.3). For development docs, go here.

Trace task execution.

This module defines how the task execution is traced: errors are recorded, handlers are applied and so on.

class, retval=None)[source]

Information about task execution.

handle_error_state(task, req, eager=False, call_errbacks=True)[source]
handle_failure(task, req, store_errors=True, call_errbacks=True)[source]

Handle exception.

handle_ignore(task, req, **kwargs)[source]
handle_reject(task, req, **kwargs)[source]
handle_retry(task, req, store_errors=True, **kwargs)[source]

Handle retry exception.

state, task, loader=None, hostname=None, store_errors=True, Info=<class ''>, eager=False, propagate=False, app=None, monotonic=<built-in function monotonic>, trace_ok_t=<class ''>, IGNORE_STATES=frozenset({'REJECTED', 'RETRY', 'IGNORED'}))[source]

Return a function that traces task execution.

Catches all exceptions and updates result backend with the state and result.

If the call was successful, it saves the result to the task result backend, and sets the task status to “SUCCESS”.

If the call raises Retry, it extracts the original exception, uses that as the result and sets the task state to “RETRY”.

If the call results in an exception, it saves the exception as the task result, and sets the task state to “FAILURE”.

Return a function that takes the following arguments:

param uuid:The id of the task.
param args:List of positional args to pass on to the function.
param kwargs:Keyword arguments mapping to pass on to the function.
keyword request:
 Request dict., uuid, args, kwargs, request={}, **opts)[source]

Trace task execution., hostname=None)[source]

Setup worker related optimizations.[source]

Reset previously configured optimizations.