celery.bootsteps

celery.bootsteps

A directed acyclic graph of reusable components.

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

Blueprint containing bootsteps that can be applied to objects.

参数:
  • steps – List of steps.
  • name – Set explicit name for this blueprint.
  • app – Set the Celery app for this blueprint.
  • on_start – Optional callback applied after blueprint start.
  • on_close – Optional callback applied before blueprint close.
  • on_stopped – Optional callback applied after blueprint stopped.
  • GraphFormatter

    StepFormatter 的别名

  • alias None[源代码]

  • apply(parent, \*kwargs*)[源代码]

    Apply the steps in this blueprint to an object.

    This will apply the __init__ and include methods of each step, with the object as argument:

    1. step = Step(obj)
    2. ...
    3. step.include(obj)

    For StartStopStep the services created will also be added to the objects steps attribute.

  • claim_steps()[源代码]

  • close(parent)[源代码]

  • connect_with(other)[源代码]

  • default_steps = set([])

  • human_state()[源代码]

  • info(parent)[源代码]

  • join(timeout=None)[源代码]

  • load_step(step)[源代码]

  • name = None

  • restart(parent, method=u’stop’, description=u’restarting’, propagate=False)[源代码]

  • send_all(parent, method, description=None, reverse=True, propagate=True, args=())[源代码]

  • start(parent)[源代码]

  • started = 0

  • state = None

  • state_to_name = {0: u’initializing’, 1: u’running’, 2: u’closing’, 3: u’terminating’}

  • stop(parent, close=True, terminate=False)[源代码]

class celery.bootsteps.Step(parent, \*kwargs*)[源代码]

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 None[源代码]

  • conditional = False

    Set this to true if the step is enabled based on some condition.

  • create(parent)[源代码]

    Create the step.

  • enabled = True

    This provides the default for include_if().

  • include(parent)[源代码]

  • include_if(parent)[源代码]

    An optional predicate that decides whether this step should be created.

  • info(obj)[源代码]

  • instantiate(name, \args, **kwargs*)[源代码]

  • 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*)[源代码]

class celery.bootsteps.ConsumerStep(parent, \*kwargs*)[源代码]