This document describes the current stable version of Celery (4.3). For development docs, go here.

celery.worker

Worker implementation.

class celery.worker.WorkController(app=None, hostname=None, **kwargs)[source]

Unmanaged worker instance.

class Blueprint(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)[source]

Worker bootstep blueprint.

default_steps = {'celery.worker.autoscale:WorkerComponent', 'celery.worker.components:Beat', 'celery.worker.components:Consumer', 'celery.worker.components:Hub', 'celery.worker.components:Pool', 'celery.worker.components:StateDB', 'celery.worker.components:Timer'}
name = 'Worker'
app = None
blueprint = None
exitcode = None

contains the exit code if a SystemExit event is handled.

info()[source]
on_after_init(**kwargs)[source]
on_before_init(**kwargs)[source]
on_close()[source]
on_consumer_ready(consumer)[source]
on_init_blueprint()[source]
on_start()[source]
on_stopped()[source]
pidlock = None
pool = None
prepare_args(**kwargs)[source]
register_with_event_loop(hub)[source]
reload(modules=None, reload=False, reloader=None)[source]
rusage()[source]
semaphore = None
setup_defaults(concurrency=None, loglevel='WARN', logfile=None, task_events=None, pool=None, consumer_cls=None, timer_cls=None, timer_precision=None, autoscaler_cls=None, pool_putlocks=None, pool_restarts=None, optimization=None, O=None, statedb=None, time_limit=None, soft_time_limit=None, scheduler=None, pool_cls=None, state_db=None, task_time_limit=None, task_soft_time_limit=None, scheduler_cls=None, schedule_filename=None, max_tasks_per_child=None, prefetch_multiplier=None, disable_rate_limits=None, worker_lost_wait=None, max_memory_per_child=None, **_kw)[source]
setup_includes(includes)[source]
setup_instance(queues=None, ready_callback=None, pidfile=None, include=None, use_eventloop=None, exclude_queues=None, **kwargs)[source]
setup_queues(include, exclude=None)[source]
should_use_eventloop()[source]
signal_consumer_close()[source]
start()[source]
state
stats()[source]
stop(in_sighandler=False, exitcode=None)[source]

Graceful shutdown of the worker server.

terminate(in_sighandler=False)[source]

Not so graceful shutdown of the worker server.