This document describes the current stable version of Celery (4.3). For development docs, go here.
celery.worker.consumer
¶
Worker consumer.
-
class
celery.worker.consumer.
Consumer
(on_task_request, init_callback=<function noop>, hostname=None, pool=None, app=None, timer=None, controller=None, hub=None, amqheartbeat=None, worker_options=None, disable_rate_limits=False, initial_prefetch_count=2, prefetch_multiplier=1, **kwargs)[source]¶ Consumer blueprint.
-
class
Blueprint
(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)[source]¶ Consumer blueprint.
-
default_steps
= [u'celery.worker.consumer.connection:Connection', u'celery.worker.consumer.mingle:Mingle', u'celery.worker.consumer.events:Events', u'celery.worker.consumer.gossip:Gossip', u'celery.worker.consumer.heart:Heart', u'celery.worker.consumer.control:Control', u'celery.worker.consumer.tasks:Tasks', u'celery.worker.consumer.consumer:Evloop', u'celery.worker.consumer.agent:Agent']¶
-
name
= u'Consumer'¶
-
-
Strategies
¶ alias of
__builtin__.dict
-
connect
()[source]¶ Establish the broker connection used for consuming tasks.
Retries establishing the connection if the
broker_connection_retry
setting is enabled
-
init_callback
= None¶ Optional callback called the first time the worker is ready to receive tasks.
-
on_decode_error
(message, exc)[source]¶ Callback called if an error occurs while decoding a message.
Simply logs the error and acknowledges the message so it doesn’t enter a loop.
Parameters: - message (kombu.Message) – The message received.
- exc (Exception) – The exception being handled.
-
pool
= None¶ The current worker pool instance.
-
restart_count
= -1¶
-
timer
= None¶ A timer used for high-priority internal tasks, such as sending heartbeats.
-
class
-
class
celery.worker.consumer.
Agent
(c, **kwargs)[source]¶ Agent starts cell actors.
-
conditional
= True¶
-
name
= u'celery.worker.consumer.agent.Agent'¶
-
requires
= (step:celery.worker.consumer.connection.Connection{()},)¶
-
-
class
celery.worker.consumer.
Connection
(c, **kwargs)[source]¶ Service managing the consumer broker connection.
-
name
= u'celery.worker.consumer.connection.Connection'¶
-
-
class
celery.worker.consumer.
Control
(c, **kwargs)[source]¶ Remote control command service.
-
name
= u'celery.worker.consumer.control.Control'¶
-
requires
= (step:celery.worker.consumer.tasks.Tasks{(step:celery.worker.consumer.mingle.Mingle{(step:celery.worker.consumer.events.Events{(step:celery.worker.consumer.connection.Connection{()},)},)},)},)¶
-
-
class
celery.worker.consumer.
Events
(c, task_events=True, without_heartbeat=False, without_gossip=False, **kwargs)[source]¶ Service used for sending monitoring events.
-
name
= u'celery.worker.consumer.events.Events'¶
-
requires
= (step:celery.worker.consumer.connection.Connection{()},)¶
-
-
class
celery.worker.consumer.
Gossip
(c, without_gossip=False, interval=5.0, heartbeat_interval=2.0, **kwargs)[source]¶ Bootstep consuming events from other workers.
This keeps the logical clock value up to date.
-
compatible_transports
= set([u'amqp', u'redis'])¶
-
label
= u'Gossip'¶
-
name
= u'celery.worker.consumer.gossip.Gossip'¶
-
requires
= (step:celery.worker.consumer.mingle.Mingle{(step:celery.worker.consumer.events.Events{(step:celery.worker.consumer.connection.Connection{()},)},)},)¶
-
-
class
celery.worker.consumer.
Heart
(c, without_heartbeat=False, heartbeat_interval=None, **kwargs)[source]¶ Bootstep sending event heartbeats.
This service sends a
worker-heartbeat
message every n seconds.Note
Not to be confused with AMQP protocol level heartbeats.
-
name
= u'celery.worker.consumer.heart.Heart'¶
-
requires
= (step:celery.worker.consumer.events.Events{(step:celery.worker.consumer.connection.Connection{()},)},)¶
-
shutdown
(c)¶
-
-
class
celery.worker.consumer.
Mingle
(c, without_mingle=False, **kwargs)[source]¶ Bootstep syncing state with neighbor workers.
At startup, or upon consumer restart, this will:
- Sync logical clocks.
- Sync revoked tasks.
-
compatible_transports
= set([u'amqp', u'redis'])¶
-
label
= u'Mingle'¶
-
name
= u'celery.worker.consumer.mingle.Mingle'¶
-
requires
= (step:celery.worker.consumer.events.Events{(step:celery.worker.consumer.connection.Connection{()},)},)¶
-
class
celery.worker.consumer.
Tasks
(c, **kwargs)[source]¶ Bootstep starting the task message consumer.
-
name
= u'celery.worker.consumer.tasks.Tasks'¶
-
requires
= (step:celery.worker.consumer.mingle.Mingle{(step:celery.worker.consumer.events.Events{(step:celery.worker.consumer.connection.Connection{()},)},)},)¶
-