![]() |
Belle II Software
release-05-01-25
|
Public Member Functions | |
def | __init__ (self, calibration, iov_to_calibrate=None, initial_state="init", iteration=0) |
def | files_containing_iov (self, file_paths, files_to_iovs, iov) |
def | dependencies_completed (self) |
def | automatic_transition (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 | |
States that are defaults to the CalibrationMachine (could override later) | |
calibration | |
Calibration object whose state we are modelling. | |
iteration | |
Allows calibration object to hold a refernce to the machine controlling it. More... | |
collector_backend | |
Backend used for this calibration machine collector. | |
iov_to_calibrate | |
IoV to be executed, currently will loop over all runs in IoV. | |
root_dir | |
root directory for this Calibration | |
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 | |
string | collector_input_dir = 'collector_input' |
string | collector_output_dir = 'collector_output' |
string | algorithm_output_dir = 'algorithm_output' |
Private Member Functions | |
def | _update_cal_state (self, **kwargs) |
def | _dump_job_config (self) |
def | _recover_collector_jobs (self) |
def | _iov_requested (self) |
def | _resolve_file_paths (self) |
def | _build_iov_dicts (self) |
def | _below_max_iterations (self) |
def | _increment_iteration (self) |
def | _collection_completed (self) |
def | _collection_failed (self) |
def | _runner_not_failed (self) |
def | _runner_failed (self) |
def | _collector_jobs_ready (self) |
def | _submit_collections (self) |
def | _no_require_iteration (self) |
def | _require_iteration (self) |
def | _log_new_state (self, **kwargs) |
def | _make_output_dir (self) |
def | _make_collector_path (self, name, collection) |
def | _make_pre_collector_path (self, name, collection) |
def | _create_collector_jobs (self) |
def | _check_valid_collector_output (self) |
def | _run_algorithms (self) |
def | _prepare_final_db (self) |
def | _trigger (self, transition_name, transition_dict, **kwargs) |
Static Private Member Functions | |
def | _callback (func, **kwargs) |
Private Attributes | |
_algorithm_results | |
Results of each iteration for all algorithms of this calibration. | |
_runner_final_state | |
Final state of the algorithm runner for the current iteration. | |
_collector_timing | |
Times of various useful updates to the collector job e.g. More... | |
_collector_jobs | |
The collector jobs used for submission. | |
_state | |
_initial_state | |
Actual attribute holding initial state for this machine. | |
A state machine to handle `Calibration` objects and the flow of processing for them.
Definition at line 373 of file state_machines.py.
def __init__ | ( | self, | |
calibration, | |||
iov_to_calibrate = None , |
|||
initial_state = "init" , |
|||
iteration = 0 |
|||
) |
Takes a Calibration object from the caf framework and lets you set the initial state.
Definition at line 383 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 295 of file state_machines.py.
|
private |
Definition at line 550 of file state_machines.py.
|
private |
Build IoV file dictionary for each collection if required.
Definition at line 527 of file state_machines.py.
|
staticprivateinherited |
Calls a condition/before/after.. function using arguments passed (or not).
Definition at line 330 of file state_machines.py.
|
private |
Did all the collections succeed?
Definition at line 561 of file state_machines.py.
|
private |
Did any of the collections fail?
Definition at line 569 of file state_machines.py.
|
private |
Definition at line 594 of file state_machines.py.
|
private |
Creates a Job object for the collections of this iteration, ready for submission to backend.
Definition at line 716 of file state_machines.py.
|
private |
Dumps the `Job` object for the collections to JSON files so that it's configuration can be recovered later in case of failure.
Definition at line 484 of file state_machines.py.
|
private |
Definition at line 555 of file state_machines.py.
|
private |
Definition at line 512 of file state_machines.py.
|
private |
Definition at line 641 of file state_machines.py.
|
private |
Creates a basf2 path for the correct collector and serializes it in the self.output_dir/<calibration_name>/<iteration>/paths directory
Definition at line 682 of file state_machines.py.
|
private |
Creates the overall root directory of the Calibration. Will not overwrite if it already exists. Also creates s
Definition at line 675 of file state_machines.py.
|
private |
Creates a basf2 path for the collectors setup path (Collection.pre_collector_path) and serializes it in the self.output_dir/<calibration_name>/<iteration>/<colector_output>/<name> directory.
Definition at line 701 of file state_machines.py.
|
private |
Definition at line 617 of file state_machines.py.
|
private |
Take the last iteration's outputdb and copy it to a more easily findable place.
Definition at line 900 of file state_machines.py.
|
private |
Recovers the `Job` object for the collector from a JSON file in the event that we are starting from a reset.
Definition at line 501 of file state_machines.py.
|
private |
Definition at line 628 of file state_machines.py.
|
private |
Definition at line 522 of file state_machines.py.
|
private |
Runs the Calibration Algorithms for this calibration machine. Will run them sequentially locally (possible benefits to using a processing pool for low memory algorithms later on.)
Definition at line 836 of file state_machines.py.
|
private |
Returns: bool: If AlgorithmsRunner failed return True.
Definition at line 584 of file state_machines.py.
|
private |
Returns: bool: If AlgorithmsRunner succeeded return True.
Definition at line 577 of file state_machines.py.
|
private |
Definition at line 610 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 307 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 182 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 253 of file state_machines.py.
def automatic_transition | ( | self | ) |
Automatically try all transitions out of this state once. Tries fail last.
Definition at line 657 of file state_machines.py.
|
staticinherited |
Method to always return True.
Definition at line 247 of file state_machines.py.
def dependencies_completed | ( | self | ) |
Condition function to check that the dependencies of our calibration are in the 'completed' state. Technically only need to check explicit dependencies.
Definition at line 646 of file state_machines.py.
def files_containing_iov | ( | self, | |
file_paths, | |||
files_to_iovs, | |||
iov | |||
) |
Lookup function that returns all files from the file_paths that overlap with this IoV.
Definition at line 471 of file state_machines.py.
|
inherited |
Returns the transition dictionary for a state and transition out of it.
Definition at line 347 of file state_machines.py.
|
inherited |
Returns allowed transitions from a given state.
Definition at line 336 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 198 of file state_machines.py.
|
inherited |
Definition at line 205 of file state_machines.py.
|
inherited |
Does a simple dot file creation to visualise states and transiitons.
Definition at line 358 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 216 of file state_machines.py.
|
inherited |
Definition at line 225 of file state_machines.py.
|
private |
Times of various useful updates to the collector job e.g.
start, elapsed, last update Used to periodically call update_status on the collector job and find out an overall number of jobs remaining + estimated remaining time
Definition at line 432 of file state_machines.py.
iteration |
Allows calibration object to hold a refernce to the machine controlling it.
Which iteration step are we in
Definition at line 417 of file state_machines.py.