This document describes an older version of Celery (2.2). For the latest stable version please go here.


Base class for worker state elements. = 150

Hartbeat expiry time in seconds. The worker will be considered offline if no heartbeat is received within this time. Default is 2:30 minutes.

class, max_workers_in_memory=5000, max_tasks_in_memory=10000)

Records clusters state.


Returns a list of (seemingly) alive workers.

event_count = 0
freeze_while(fun, *args, **kwargs)

Get or create task by uuid.

get_or_create_worker(hostname, **kwargs)

Get or create worker by hostname.

task_count = 0
task_event(type, fields)

Process task event.


Returns a list of all seen task types.


Get tasks by timestamp.

Returns a list of (uuid, task) tuples.

tasks_by_type(name, limit=None)

Get all tasks by type.

Returns a list of (uuid, task) tuples.

tasks_by_worker(hostname, limit=None)

Get all tasks by worker.

Returns a list of (uuid, task) tuples.

worker_event(type, fields)

Process worker event.


Task State.

info(fields=None, extra=[])

Information about this task suitable for on-screen display.

merge(state, timestamp, fields)

Merge with out of order event.

merge_rules = {'RECEIVED': ('name', 'args', 'kwargs', 'retries', 'eta', 'expires')}

How to merge out of order events. Disorder is detected by logical ordering (e.g. task-received must have happened before a task-failed event).

A merge rule consists of a state and a list of fields to keep from that state. (RECEIVED, ("name", "args"), means the name and args fields are always taken from the RECEIVED state, and any values for these fields received before or after is simply ignored.

on_failed(timestamp=None, **fields)

Callback for the task-failed event.

on_received(timestamp=None, **fields)

Callback for the task-received event.

on_retried(timestamp=None, **fields)

Callback for the task-retried event.

on_revoked(timestamp=None, **fields)

Callback for the task-revoked event.

on_sent(timestamp=None, **fields)

Callback for the task-sent event.

on_started(timestamp=None, **fields)

Callback for the task-started event.

on_succeeded(timestamp=None, **fields)

Callback for the task-succeeded event.

update(state, timestamp, fields)

Update state from new event.

  • state – State from event.
  • timestamp – Timestamp from event.
  • fields – Event data.

Worker State.

heartbeat_max = 4
on_heartbeat(timestamp=None, **kwargs)

Callback for the worker-heartbeat event.


Callback for the worker-offline event.

on_online(timestamp=None, **kwargs)

Callback for the worker-online event.

Previous topic

Next topic


This Page