celery.worker
celery.worker
WorkController can be used to instantiate in-process workers.
The worker consists of several components, all managed by bootsteps (mod:celery.bootsteps).
class celery.worker.WorkController(app=None, hostname=None, \*kwargs*)[源代码]
Unmanaged worker instance.
class Blueprint(steps=None, name=None, app=None, on_start=None, on_close=None, on_stopped=None)
Worker bootstep blueprint.
default_steps = set([‘celery.worker.components:Consumer’, ‘celery.worker.components:Timer’, ‘celery.worker.components:Queues’, ‘celery.worker.autoreload:WorkerComponent’, ‘celery.worker.components:Hub’, ‘celery.worker.components:Beat’, ‘celery.worker.components:Pool’, ‘celery.worker.autoscale:WorkerComponent’, ‘celery.worker.components:StateDB’])
name = ‘Worker’
WorkController.app = None
WorkController.blueprint = None
WorkController.info()
WorkController.on_after_init(\*kwargs*)
WorkController.on_before_init(\*kwargs*)
WorkController.on_close()
WorkController.on_consumer_ready(consumer)
WorkController.on_init_blueprint()
WorkController.on_start()
WorkController.on_stopped()
WorkController.pidlock = None
WorkController.pool = None
WorkController.prepare_args(\*kwargs*)
WorkController.register_with_event_loop(hub)
WorkController.reload(modules=None, reload=False, reloader=None)[源代码]
WorkController.rusage()
WorkController.semaphore = None
WorkController.setup_defaults(concurrency=None, loglevel=None, logfile=None, send_events=None, pool_cls=None, consumer_cls=None, timer_cls=None, timer_precision=None, autoscaler_cls=None, autoreloader_cls=None, pool_putlocks=None, pool_restarts=None, force_execv=None, state_db=None, schedule_filename=None, scheduler_cls=None, task_time_limit=None, task_soft_time_limit=None, max_tasks_per_child=None, prefetch_multiplier=None, disable_rate_limits=None, worker_lost_wait=None, \*_kw*)
WorkController.setup_includes(includes)
WorkController.setup_instance(queues=None, ready_callback=None, pidfile=None, include=None, use_eventloop=None, exclude_queues=None, \*kwargs*)
WorkController.setup_queues(include, exclude=None)
WorkController.should_use_eventloop()[源代码]
WorkController.signal_consumer_close()[源代码]
WorkController.start()[源代码]
Starts the workers main loop.
WorkController.state None[源代码]
WorkController.stats()
WorkController.stop(in_sighandler=False)[源代码]
Graceful shutdown of the worker server.
WorkController.terminate(in_sighandler=False)[源代码]
Not so graceful shutdown of the worker server.
celery.worker.default_nodename(hostname)