selinon.failures module

Task and flow failure handling.

class selinon.failures.Failures(raw_definition, system, flow, last_allocated=None, starting_nodes=None, predicates=None)[source]

Bases: object

Node failures and fallback handling.

all_fallback_nodes()[source]

Compute all fallback nodes.

Returns:all nodes that are used as fallback nodes
all_waiting_nodes()[source]

Compute all nodes that have defined a fallback.

Returns:all nodes that for which there is defined a callback
static construct(system, flow, failures_dict)[source]

Construct Failres.

Parameters:
  • system – system context
  • flow – a flow to which failures conform
  • failures_dict – construct failures from failures dict
Return type:

Failures

dump2stream(stream)[source]

Dump failures to the Python config file for Dispatcher.

Parameters:stream – output stream to dump to
dump_all_conditions2stream(stream)[source]

Dump all condition sources that are present to a stream.

Parameters:stream – output stream to dump to
static failure_node_name(flow_name, failure_node)[source]

Create a failure node name representation for generated Python config.

Parameters:
  • flow_name – name of flow for which the representation should be created
  • failure_node – a node from graph of all failure permutations
Returns:

variable name

Return type:

str

fallback_nodes_names()[source]

Compute names for all nodes that are started by fallbacks.

Returns:names of nodes that are started by fallbacks in all failures
static starting_nodes_name(flow_name)[source]

Create a starting node name for graph of all failures nodes for generated Python config.

Parameters:flow_name – flow name for which the starting node should be created
Returns:variable name
Return type:str
waiting_nodes_names()[source]

Compute all nodes that have defined fallbacks.

Returns:names of all nodes that we are expecting to fail for fallbacks