bootsteps

A directed acyclic graph of reusable components.

Module Contents

Classes

StepFormatter() Graph formatter for Blueprint.
Blueprint(self,steps=None,name=None,on_start=None,on_close=None,on_stopped=None) Blueprint containing bootsteps that can be applied to objects.
StepType() Meta-class for steps.
Step(self,parent,**kwargs) A Bootstep.
StartStopStep() Bootstep that must be started and stopped in order.
ConsumerStep() Bootstep that starts a message consumer.

Functions

_pre(ns,fmt)
_label(s)
_pre(ns, fmt)
_label(s)
class StepFormatter

Graph formatter for Blueprint.

label(step)
_get_prefix(step)
node(obj, **attrs)
edge(a, b, **attrs)
class Blueprint(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)

Blueprint containing bootsteps that can be applied to objects.

Arguments:

steps Sequence[Union[str, Step]]: 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.
__init__(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)
start(parent)
human_state()
info(parent)
close(parent)
restart(parent, method="stop", description="restarting", propagate=False)
send_all(parent, method, description=None, reverse=True, propagate=True, args=tuple)
stop(parent, close=True, terminate=False)
join(timeout=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:

step = Step(obj)
...
step.include(obj)

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

connect_with(other)
__getitem__(name)
_find_last()
_firstpass(steps)
_finalize_steps(steps)
claim_steps()
load_step(step)
_debug(msg, *args)
alias()
class StepType

Meta-class for steps.

__new__(name, bases, attrs)
__str__()
__repr__()
class 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.

__init__(parent, **kwargs)
include_if(parent)

Return true if bootstep should be included.

You can define this as an optional predicate that decides whether this step should be created.

instantiate(name, *args, **kwargs)
_should_include(parent)
include(parent)
create(parent)

Create the step.

__repr__()
alias()
info(obj)
class StartStopStep

Bootstep that must be started and stopped in order.

start(parent)
stop(parent)
close(parent)
terminate(parent)
include(parent)
class ConsumerStep

Bootstep that starts a message consumer.

get_consumers(channel)
start(c)
stop(c)
shutdown(c)
_close(c, cancel_consumers=True)