This document describes Celery 3.1. For development docs, go here.

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 0x9f706f4>, hostname=None, eventer=None, app=None, connection_errors=None, request_dict=None, message=None, task=None, on_reject=<function noop at 0x9f706f4>, **opts)[source]

A request for task execution.

acknowledge()[source]

Acknowledge task.

acknowledged
app
args
connection_errors
correlation_id[source]
delivery_info[source]
error_msg = u' Task %(name)s[%(id)s] %(description)s: %(exc)s\n '

Format string used to log task failure.

eta
eventer
execute(loglevel=None, logfile=None)[source]

Execute the task in a trace_task().

Parameters:
  • loglevel – The loglevel used by the task.
  • logfile – The logfile used by the task.
execute_using_pool(pool, **kwargs)[source]

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

Parameters:pool – A celery.concurrency.base.TaskPool instance.
Raises celery.exceptions.TaskRevokedError:
 if the task was revoked and ignored.
expires
extend_with_default_kwargs()[source]

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
id
ignored_msg = u' Task %(name)s[%(id)s] %(description)s\n '
info(safe=False)[source]
internal_error_msg = u' Task %(name)s[%(id)s] %(description)s: %(exc)s\n '

Format string used to log internal error.

kwargs
maybe_expire()[source]

If expired, mark the task as revoked.

name
on_accepted(pid, time_accepted)[source]

Handler called when task is accepted by worker pool.

on_ack
on_failure(exc_info)[source]

Handler called if the task raised an exception.

on_reject
on_retry(exc_info)[source]

Handler called if the task should be retried.

on_success(ret_value, now=None, nowfun=<function _monotonic at 0x8da7684>)[source]

Handler called if the task was successfully processed.

on_timeout(soft, timeout)[source]

Handler called if the task times out.

reject(requeue=False)[source]
rejected_msg = u' Task %(name)s[%(id)s] %(exc)s\n '
reply_to[source]
repr_result(result, maxlen=46)[source]
request_dict
retry_msg = u'Task %(name)s[%(id)s] retry: %(exc)s'

Format string used to log task retry.

revoked()[source]

If revoked, skip task and mark state.

send_event(type, **fields)[source]
shortinfo()
store_errors[source]
success_msg = u' Task %(name)s[%(id)s] succeeded in %(runtime)ss: %(return_value)s\n '

Format string used to log task success.

task
task_id[source]
task_name[source]
terminate(pool, signal=None)[source]
time_start
tzlocal[source]
utc
worker_pid

Previous topic

celery.worker.consumer

Next topic

celery.worker.state

This Page