This document describes the current stable version of Celery (4.2). For development docs, go here.
celery.bootsteps
¶
A directed acyclic graph of reusable components.
-
class
celery.bootsteps.
Blueprint
(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)[source]¶ Blueprint containing bootsteps that can be applied to objects.
Parameters: - Sequence[Union[str, Step]] (steps) – List of steps.
- name (str) – Set explicit name for this blueprint.
- on_start (Callable) – Optional callback applied after blueprint start.
- on_close (Callable) – Optional callback applied before blueprint close.
- on_stopped (Callable) – Optional callback applied after blueprint stopped.
-
GraphFormatter
¶ alias of
StepFormatter
-
alias
¶
-
apply
(parent, **kwargs)[source]¶ Apply the steps in this blueprint to an object.
This will apply the
__init__
andinclude
methods of each step, with the object as argument:step = Step(obj) ... step.include(obj)
For
StartStopStep
the services created will also be added to the objectssteps
attribute.
-
default_steps
= set([])¶
-
name
= None¶
-
started
= 0¶
-
state
= None¶
-
state_to_name
= {0: u'initializing', 1: u'running', 2: u'closing', 3: u'terminating'}¶
-
class
celery.bootsteps.
Step
(parent, **kwargs)[source]¶ A Bootstep.
The
__init__()
method is called when the step is bound to a parent object, and can as such be used to initialize attributes in the parent object at parent instantiation-time.-
alias
¶
-
conditional
= False¶ Set this to true if the step is enabled based on some condition.
-
enabled
= True¶ This provides the default for
include_if()
.
-
include_if
(parent)[source]¶ Return true if bootstep should be included.
You can define this as an optional predicate that decides whether this step should be created.
-
label
= None¶ Optional short name used for graph outputs and in logs.
-
last
= False¶ This flag is reserved for the workers Consumer, since it is required to always be started last. There can only be one object marked last in every blueprint.
-
name
= u'celery.bootsteps.Step'¶ Optional step name, will use
qualname
if not specified.
-
requires
= ()¶ List of other steps that that must be started before this step. Note that all dependencies must be in the same blueprint.
-
-
class
celery.bootsteps.
StartStopStep
(parent, **kwargs)[source]¶ Bootstep that must be started and stopped in order.
-
name
= u'celery.bootsteps.StartStopStep'¶
-
obj
= None¶ Optional obj created by the
create()
method. This is used byStartStopStep
to keep the original service object.
-