celery.app.trace

Trace task execution.

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

class celery.app.trace.TraceInfo(state, retval=None)[исходный код]

Information about task execution.

handle_error_state(task, req, eager=False, call_errbacks=True)[исходный код]
handle_failure(task, req, store_errors=True, call_errbacks=True)[исходный код]

Handle exception.

handle_ignore(task, req, **kwargs)[исходный код]
handle_reject(task, req, **kwargs)[исходный код]
handle_retry(task, req, store_errors=True, **kwargs)[исходный код]

Handle retry exception.

retval
state
celery.app.trace.build_tracer(name: str, task: ~typing.Union[~celery.app.task.Task, ~celery.local.PromiseProxy], loader: ~typing.Optional[~celery.loaders.app.AppLoader] = None, hostname: ~typing.Optional[str] = None, store_errors: bool = True, Info: ~typing.Type[~celery.app.trace.TraceInfo] = <class 'celery.app.trace.TraceInfo'>, eager: bool = False, propagate: bool = False, app: ~typing.Optional[~celery.app.base.Celery] = None, monotonic: ~typing.Callable[[], int] = <built-in function monotonic>, trace_ok_t: ~typing.Type[~celery.app.trace.trace_ok_t] = <class 'celery.app.trace.trace_ok_t'>, IGNORE_STATES: ~typing.FrozenSet[str] = frozenset({'IGNORED', 'REJECTED', 'RETRY'})) Callable[[str, Tuple[Any, ...], Dict[str, Any], Any], trace_ok_t][исходный код]

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.

celery.app.trace.reset_worker_optimizations(app=<Celery default>)[исходный код]

Reset previously configured optimizations.

celery.app.trace.setup_worker_optimizations(app, hostname=None)[исходный код]

Setup worker related optimizations.

celery.app.trace.trace_task(task, uuid, args, kwargs, request=None, **opts)[исходный код]

Trace task execution.

Back to Top