celery.app.trace

celery.app.trace

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)[源代码]

  • handle_error_state(task, eager=False)[源代码]

  • handle_failure(task, store_errors=True)[源代码]

    Handle exception.

  • handle_retry(task, store_errors=True)[源代码]

    Handle retry exception.

  • retval None

  • state None

celery.app.trace.build_tracer(name, task, loader=None, hostname=None, store_errors=True, Info=<class ‘celery.app.trace.TraceInfo’>, eager=False, propagate=False, app=None, IGNORE_STATES=frozenset([‘IGNORED’, ‘RETRY’, ‘REJECTED’]))[源代码]

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.trace_task(task, uuid, args, kwargs, request={}, \*opts*)[源代码]

celery.app.trace.eager_trace_task(task, uuid, args, kwargs, request=None, \*opts*)[源代码]

celery.app.trace.setup_worker_optimizations(app)[源代码]

celery.app.trace.reset_worker_optimizations()[源代码]