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

celery.worker

Worker implementation.

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

Unmanaged worker instance.

class Blueprint(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)[源代码]

Worker bootstep blueprint.

default_steps = set([u'celery.worker.components:Consumer', u'celery.worker.components:Hub', u'celery.worker.components:Timer', u'celery.worker.autoscale:WorkerComponent', u'celery.worker.components:Beat', u'celery.worker.components:Pool', u'celery.worker.components:StateDB'])
name = u'Worker'
app = None
blueprint = None
exitcode = None

contains the exit code if a SystemExit event is handled.

info()[源代码]
on_after_init(**kwargs)[源代码]
on_before_init(**kwargs)[源代码]
on_close()[源代码]
on_consumer_ready(consumer)[源代码]
on_init_blueprint()[源代码]
on_start()[源代码]
on_stopped()[源代码]
pidlock = None
pool = None
prepare_args(**kwargs)[源代码]
register_with_event_loop(hub)[源代码]
reload(modules=None, reload=False, reloader=None)[源代码]
rusage()[源代码]
semaphore = None
setup_defaults(concurrency=None, loglevel=u'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)[源代码]
setup_includes(includes)[源代码]
setup_instance(queues=None, ready_callback=None, pidfile=None, include=None, use_eventloop=None, exclude_queues=None, **kwargs)[源代码]
setup_queues(include, exclude=None)[源代码]
should_use_eventloop()[源代码]
signal_consumer_close()[源代码]
start()[源代码]
state
stats()[源代码]
stop(in_sighandler=False, exitcode=None)[源代码]

Graceful shutdown of the worker server.

terminate(in_sighandler=False)[源代码]

Not so graceful shutdown of the worker server.