![]() |
Belle II Software
release-06-01-15
|
Public Member Functions | |
def | __init__ (self, algorithm=None, initial_state="init") |
def | setup_from_dict (self, params) |
def | is_valid (self) |
def | initial_state (self) |
def | initial_state (self, state) |
def | state (self) |
def | state (self, state) |
def | add_state (self, state, enter=None, exit=None) |
def | add_transition (self, trigger, source, dest, conditions=None, before=None, after=None) |
def | __getattr__ (self, name, **kwargs) |
def | get_transitions (self, source) |
def | get_transition_dict (self, state, transition) |
def | save_graph (self, filename, graphname) |
Static Public Member Functions | |
def | default_condition (**kwargs) |
Public Attributes | |
default_states | |
Default states for the AlgorithmMachine. | |
algorithm | |
Algorithm() object whose state we are modelling. | |
input_files | |
Collector output files, will contain all files retured by the output patterns. | |
dependent_databases | |
CAF created local databases from previous calibrations that this calibration/algorithm depends on. | |
database_chain | |
Assigned database chain to the overall Calibration object, or to the 'default' Collection. More... | |
output_dir | |
The algorithm output directory which is mostly used to store the stdout file. | |
output_database_dir | |
The output database directory for the localdb that the algorithm will commit to. | |
result | |
IoV_Result object for a single execution, will be reset upon a new execution. | |
states | |
Valid states for this machine. | |
initial_state | |
Pointless docstring since it's a property. | |
transitions | |
Allowed transitions between states. | |
state | |
Current State of machine. | |
Static Public Attributes | |
list | required_attrs |
Required attributes that must exist before the machine can run properly. More... | |
list | required_true_attrs |
Attributes that must have a value that returns True when tested. More... | |
Private Member Functions | |
def | _create_output_dir (self, **kwargs) |
def | _setup_database_chain (self, **kwargs) |
def | _setup_logging (self, **kwargs) |
def | _change_working_dir (self, **kwargs) |
def | _pre_algorithm (self, **kwargs) |
def | _execute_over_iov (self, **kwargs) |
def | _set_input_data (self, **kwargs) |
def | _trigger (self, transition_name, transition_dict, **kwargs) |
Static Private Member Functions | |
def | _callback (func, **kwargs) |
Private Attributes | |
_initial_state | |
Actual attribute holding initial state for this machine. | |
_state | |
Actual attribute holding the Current state. More... | |
A state machine to handle the logic of running the algorithm on the overall runs contained in the data.
Definition at line 920 of file state_machines.py.
def __init__ | ( | self, | |
algorithm = None , |
|||
initial_state = "init" |
|||
) |
Takes an Algorithm object from the caf framework and defines the transitions.
Reimplemented from Machine.
Definition at line 942 of file state_machines.py.
|
inherited |
Allows us to create a new method for each trigger on the fly. If there is no trigger name in the machine to match, then the normal AttributeError is called.
Definition at line 300 of file state_machines.py.
|
staticprivateinherited |
Calls a condition/before/after.. function using arguments passed (or not).
Definition at line 336 of file state_machines.py.
|
private |
Definition at line 1065 of file state_machines.py.
|
private |
Create working/output directory of algorithm. Any old directory is overwritten.
Definition at line 1011 of file state_machines.py.
|
private |
Does the actual execute of the algorithm on an IoV and records the result.
Definition at line 1081 of file state_machines.py.
|
private |
Call the user defined algorithm setup function.
Definition at line 1071 of file state_machines.py.
|
private |
Apply all databases in the correct order.
Definition at line 1017 of file state_machines.py.
|
private |
Definition at line 1055 of file state_machines.py.
|
privateinherited |
Runs the transition logic. Callbacks are evaluated in the order: conditions -> before -> <new state set here> -> after.
Definition at line 312 of file state_machines.py.
|
inherited |
Adds a single state to the list of possible ones. Should be a unique string or a State object with a unique name.
Definition at line 187 of file state_machines.py.
|
inherited |
Adds a single transition to the dictionary of possible ones. Trigger is the method name that begins the transtion between the source state and the destination state. The condition is an optional function that returns True or False depending on the current state/input.
Definition at line 258 of file state_machines.py.
|
staticinherited |
Method to always return True.
Definition at line 252 of file state_machines.py.
|
inherited |
Returns the transition dictionary for a state and transition out of it.
Definition at line 353 of file state_machines.py.
|
inherited |
Returns allowed transitions from a given state.
Definition at line 342 of file state_machines.py.
|
inherited |
The initial state of the machine. Needs a special property to prevent trying to run on_enter callbacks when set.
Definition at line 203 of file state_machines.py.
|
inherited |
Definition at line 210 of file state_machines.py.
def is_valid | ( | self | ) |
Returns: bool: Whether or not this machine has been set up correctly with all its necessary attributes.
Definition at line 993 of file state_machines.py.
|
inherited |
Does a simple dot file creation to visualise states and transiitons.
Definition at line 364 of file state_machines.py.
def setup_from_dict | ( | self, | |
params | |||
) |
Parameters: params (dict): Dictionary containing values to be assigned to the machine's attributes of the same name.
Definition at line 985 of file state_machines.py.
|
inherited |
The current state of the machine. Actually a `property` decorator. It will call the exit method of the current state and enter method of the new one. To get around the behaviour e.g. for setting initial states, either use the `initial_state` property or directly set the _state attribute itself (at your own risk!).
Definition at line 221 of file state_machines.py.
|
inherited |
Definition at line 230 of file state_machines.py.
|
privateinherited |
Actual attribute holding the Current state.
Current state (private)
Definition at line 183 of file state_machines.py.
database_chain |
Assigned database chain to the overall Calibration object, or to the 'default' Collection.
Database chains for manually created Collections have no effect here.
Definition at line 963 of file state_machines.py.
|
static |
Required attributes that must exist before the machine can run properly.
Some are allowed be values that return False whe tested e.g. "" or []
Definition at line 927 of file state_machines.py.
|
static |
Attributes that must have a value that returns True when tested.
Definition at line 936 of file state_machines.py.