celery.worker.job

celery.worker.job

This module defines the Request class, which specifies how tasks are executed.

class celery.worker.job.Request(body, on_ack=<function noop at 0xb08df7c>, hostname=None, eventer=None, app=None, connection_errors=None, request_dict=None, message=None, task=None, on_reject=<function noop at 0xb08df7c>, \*opts*)[源代码]

A request for task execution.

  • acknowledge()[源代码]

    Acknowledge task.

  • acknowledged None

  • app None

  • args None

  • connection_errors None

  • correlation_id None

  • delivery_info None

  • error_msg = u’ Task %(name)s[%(id)s] %(description)s: %(exc)s\n ‘

    Format string used to log task failure.

  • eta None

  • eventer None

  • execute(loglevel=None, logfile=None)[源代码]

    Execute the task in a trace_task().

    参数:
    • loglevel – The loglevel used by the task.
    • logfile – The logfile used by the task.
  • execute_using_pool(pool, \*kwargs*)[源代码]

    Used by the worker to send this task to the pool.

    参数:pool – A celery.concurrency.base.TaskPool instance.
    引发 celery.exceptions.TaskRevokedError:
     if the task was revoked and ignored.
  • expires None

  • extend_with_default_kwargs()[源代码]

    Extend the tasks keyword arguments with standard task arguments.

    Currently these are logfile, loglevel, task_id, task_name, task_retries, and delivery_info.

    See celery.task.base.Task.run() for more information.

    Magic keyword arguments are deprecated and will be removed in version 4.0.

  • hostname None

  • id None

  • ignored_msg = u’ Task %(name)s[%(id)s] %(description)s\n ‘

  • info(safe=False)[源代码]

  • internal_error_msg = u’ Task %(name)s[%(id)s] %(description)s: %(exc)s\n ‘

    Format string used to log internal error.

  • kwargs None

  • maybe_expire()[源代码]

    If expired, mark the task as revoked.

  • name None

  • on_accepted(pid, time_accepted)[源代码]

    Handler called when task is accepted by worker pool.

  • on_ack None

  • on_failure(exc_info)[源代码]

    Handler called if the task raised an exception.

  • on_reject None

  • on_retry(exc_info)[源代码]

    Handler called if the task should be retried.

  • on_success(ret_value, now=None, nowfun=<function _monotonic at 0x93ee4c4>)[源代码]

    Handler called if the task was successfully processed.

  • on_timeout(soft, timeout)[源代码]

    Handler called if the task times out.

  • reject(requeue=False)

  • rejected_msg = u’ Task %(name)s[%(id)s] %(exc)s\n ‘

  • reply_to None

  • repr_result(result, maxlen=128)[源代码]

  • request_dict None

  • retry_msg = u’Task %(name)s[%(id)s] retry: %(exc)s’

    Format string used to log task retry.

  • revoked()[源代码]

    If revoked, skip task and mark state.

  • send_event(type, \*fields*)[源代码]

  • shortinfo()

  • store_errors None[源代码]

  • success_msg = u’ Task %(name)s[%(id)s] succeeded in %(runtime)ss: %(return_value)s\n ‘

    Format string used to log task success.

  • task None

  • task_id None

  • task_name None

  • terminate(pool, signal=None)[源代码]

  • time_start None

  • tzlocal None[源代码]

  • utc None

  • worker_pid None