![]() |
Belle II Software development
|
Public Member Functions | |
| __init__ (self, algorithm=None, initial_state="init") | |
| setup_from_dict (self, params) | |
| is_valid (self) | |
| initial_state (self) | |
| initial_state (self, state) | |
| state (self) | |
| state (self, state) | |
| add_state (self, state, enter=None, exit=None) | |
| add_transition (self, trigger, source, dest, conditions=None, before=None, after=None) | |
| __getattr__ (self, name, **kwargs) | |
| get_transitions (self, source) | |
| get_transition_dict (self, state, transition) | |
| save_graph (self, filename, graphname) | |
Static Public Member Functions | |
| default_condition (**kwargs) | |
Public Attributes | |
| list | default_states |
| Default states for the AlgorithmMachine. | |
| algorithm = algorithm | |
| Algorithm() object whose state we are modelling. | |
| list | input_files = [] |
| Collector output files, will contain all files returned by the output patterns. | |
| list | dependent_databases = [] |
| CAF created local databases from previous calibrations that this calibration/algorithm depends on. | |
| list | database_chain = [] |
| Assigned database chain to the overall Calibration object, or to the 'default' Collection. | |
| str | output_dir = "" |
| The algorithm output directory which is mostly used to store the stdout file. | |
| str | output_database_dir = "" |
| The output database directory for the localdb that the algorithm will commit to. | |
| result = None | |
| IoV_Result object for a single execution, will be reset upon a new execution. | |
| dict | states = {} |
| Valid states for this machine. | |
| initial_state = initial_state | |
| Pointless docstring since it's a property. | |
| transitions = defaultdict(list) | |
| Allowed transitions between states. | |
| state = dest | |
| Current State of machine. | |
Static Public Attributes | |
| list | required_attrs |
| Required attributes that must exist before the machine can run properly. | |
| list | required_true_attrs |
| Attributes that must have a value that returns True when tested. | |
Protected Member Functions | |
| _create_output_dir (self, **kwargs) | |
| _setup_database_chain (self, **kwargs) | |
| _setup_logging (self, **kwargs) | |
| _change_working_dir (self, **kwargs) | |
| _pre_algorithm (self, **kwargs) | |
| _execute_over_iov (self, **kwargs) | |
| _set_input_data (self, **kwargs) | |
| _trigger (self, transition_name, transition_dict, **kwargs) | |
Static Protected Member Functions | |
| _callback (func, **kwargs) | |
Protected Attributes | |
| dict | _initial_state = State(initial_state) |
| Actual attribute holding initial state for this machine. | |
| dict | _state = self.initial_state |
| Actual attribute holding the Current state. | |
A state machine to handle the logic of running the algorithm on the overall runs contained in the data.
Definition at line 935 of file state_machines.py.
| __init__ | ( | self, | |
| algorithm = None, | |||
| initial_state = "init" ) |
Takes an Algorithm object from the caf framework and defines the transitions.
Definition at line 957 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 306 of file state_machines.py.
|
staticprotectedinherited |
Calls a condition/before/after.. function using arguments passed (or not).
Definition at line 344 of file state_machines.py.
|
protected |
Definition at line 1082 of file state_machines.py.
|
protected |
Create working/output directory of algorithm. Any old directory is overwritten.
Definition at line 1026 of file state_machines.py.
|
protected |
Does the actual execute of the algorithm on an IoV and records the result.
Definition at line 1098 of file state_machines.py.
|
protected |
Call the user defined algorithm setup function.
Definition at line 1088 of file state_machines.py.
|
protected |
set input data
Definition at line 1113 of file state_machines.py.
|
protected |
Apply all databases in the correct order.
Definition at line 1032 of file state_machines.py.
|
protected |
Definition at line 1072 of file state_machines.py.
|
protectedinherited |
Runs the transition logic. Callbacks are evaluated in the order: conditions -> before -> <new state set here> -> after.
Definition at line 320 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 193 of file state_machines.py.
|
inherited |
Adds a single transition to the dictionary of possible ones. Trigger is the method name that begins the transition 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 264 of file state_machines.py.
|
staticinherited |
Method to always return True.
Definition at line 258 of file state_machines.py.
|
inherited |
Returns the transition dictionary for a state and transition out of it.
Definition at line 361 of file state_machines.py.
|
inherited |
Returns allowed transitions from a given state.
Definition at line 350 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 209 of file state_machines.py.
|
inherited |
Definition at line 216 of file state_machines.py.
| is_valid | ( | self | ) |
Returns:
bool: Whether or not this machine has been set up correctly with all its necessary attributes.
Definition at line 1008 of file state_machines.py.
|
inherited |
Does a simple dot file creation to visualise states and transiitons.
Definition at line 372 of file state_machines.py.
| 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 1000 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 227 of file state_machines.py.
|
inherited |
Definition at line 236 of file state_machines.py.
|
protectedinherited |
Actual attribute holding initial state for this machine.
Definition at line 186 of file state_machines.py.
|
protectedinherited |
Actual attribute holding the Current state.
Definition at line 189 of file state_machines.py.
| algorithm = algorithm |
Algorithm() object whose state we are modelling.
Definition at line 971 of file state_machines.py.
| list 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 978 of file state_machines.py.
| default_states |
Default states for the AlgorithmMachine.
Definition at line 962 of file state_machines.py.
| list dependent_databases = [] |
CAF created local databases from previous calibrations that this calibration/algorithm depends on.
Definition at line 975 of file state_machines.py.
|
inherited |
Pointless docstring since it's a property.
Definition at line 182 of file state_machines.py.
| input_files = [] |
Collector output files, will contain all files returned by the output patterns.
Definition at line 973 of file state_machines.py.
| output_database_dir = "" |
The output database directory for the localdb that the algorithm will commit to.
Definition at line 982 of file state_machines.py.
| output_dir = "" |
The algorithm output directory which is mostly used to store the stdout file.
Definition at line 980 of file state_machines.py.
|
static |
Required attributes that must exist before the machine can run properly.
Some are allowed to be values that return False when tested e.g. "" or []
Definition at line 942 of file state_machines.py.
|
static |
Attributes that must have a value that returns True when tested.
Definition at line 951 of file state_machines.py.
| result = None |
IoV_Result object for a single execution, will be reset upon a new execution.
Definition at line 984 of file state_machines.py.
|
inherited |
Current State of machine.
Definition at line 336 of file state_machines.py.
|
inherited |
Valid states for this machine.
Definition at line 176 of file state_machines.py.
|
inherited |
Allowed transitions between states.
Definition at line 191 of file state_machines.py.