![]() |
Belle II Software development
|
Public Member Functions | |
__init__ (self, calibration, iov_to_calibrate=None, initial_state="init", iteration=0) | |
files_containing_iov (self, file_paths, files_to_iovs, iov) | |
dependencies_completed (self) | |
automatic_transition (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 |
States that are defaults to the CalibrationMachine (could override later) | |
calibration = calibration | |
Calibration object whose state we are modelling. | |
iteration = iteration | |
Which iteration step are we in. | |
collector_backend = None | |
Backend used for this calibration machine collector. | |
iov_to_calibrate = iov_to_calibrate | |
IoV to be executed, currently will loop over all runs in IoV. | |
root_dir = Path(os.getcwd(), calibration.name) | |
root directory for this Calibration | |
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 | |
str | collector_input_dir = 'collector_input' |
input directory of collector | |
str | collector_output_dir = 'collector_output' |
output directory of collector | |
str | algorithm_output_dir = 'algorithm_output' |
output directory of algorithm | |
Protected Member Functions | |
_update_cal_state (self, **kwargs) | |
_dump_job_config (self) | |
_recover_collector_jobs (self) | |
_iov_requested (self) | |
_resolve_file_paths (self) | |
_build_iov_dicts (self) | |
_below_max_iterations (self) | |
_increment_iteration (self) | |
_collection_completed (self) | |
_collection_failed (self) | |
_runner_not_failed (self) | |
_runner_failed (self) | |
_collector_jobs_ready (self) | |
_submit_collections (self) | |
_no_require_iteration (self) | |
_require_iteration (self) | |
_log_new_state (self, **kwargs) | |
_make_output_dir (self) | |
_make_collector_path (self, name, collection) | |
_make_pre_collector_path (self, name, collection) | |
_create_collector_jobs (self) | |
_check_valid_collector_output (self) | |
_run_algorithms (self) | |
_prepare_final_db (self) | |
_trigger (self, transition_name, transition_dict, **kwargs) | |
Static Protected Member Functions | |
_callback (func, **kwargs) | |
Protected Attributes | |
dict | _algorithm_results = {} |
Results of each iteration for all algorithms of this calibration. | |
_runner_final_state = None | |
Final state of the algorithm runner for the current iteration. | |
dict | _collector_timing = {} |
Times of various useful updates to the collector job e.g. | |
dict | _collector_jobs = {} |
The collector jobs used for submission. | |
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 `Calibration` objects and the flow of processing for them.
Definition at line 383 of file state_machines.py.
__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 396 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 302 of file state_machines.py.
|
protected |
Definition at line 564 of file state_machines.py.
|
protected |
Build IoV file dictionary for each collection if required.
Definition at line 541 of file state_machines.py.
|
staticprotectedinherited |
Calls a condition/before/after.. function using arguments passed (or not).
Definition at line 340 of file state_machines.py.
|
protected |
check that collector output is valid
Definition at line 828 of file state_machines.py.
|
protected |
Did all the collections succeed?
Definition at line 575 of file state_machines.py.
|
protected |
Did any of the collections fail?
Definition at line 583 of file state_machines.py.
|
protected |
Definition at line 608 of file state_machines.py.
|
protected |
Creates a Job object for the collections of this iteration, ready for submission to backend.
Definition at line 730 of file state_machines.py.
|
protected |
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 498 of file state_machines.py.
|
protected |
Definition at line 569 of file state_machines.py.
|
protected |
Definition at line 526 of file state_machines.py.
|
protected |
Definition at line 655 of file state_machines.py.
|
protected |
Creates a basf2 path for the correct collector and serializes it in the self.output_dir/<calibration_name>/<iteration>/paths directory
Definition at line 696 of file state_machines.py.
|
protected |
Creates the overall root directory of the Calibration. Will not overwrite if it already exists. Also creates s
Definition at line 689 of file state_machines.py.
|
protected |
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 715 of file state_machines.py.
|
protected |
Definition at line 631 of file state_machines.py.
|
protected |
Take the last iteration's outputdb and copy it to a more easily findable place.
Definition at line 915 of file state_machines.py.
|
protected |
Recovers the `Job` object for the collector from a JSON file in the event that we are starting from a reset.
Definition at line 515 of file state_machines.py.
|
protected |
Definition at line 642 of file state_machines.py.
|
protected |
Definition at line 536 of file state_machines.py.
|
protected |
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 851 of file state_machines.py.
|
protected |
Returns: bool: If AlgorithmsRunner failed return True.
Definition at line 598 of file state_machines.py.
|
protected |
Returns: bool: If AlgorithmsRunner succeeded return True.
Definition at line 591 of file state_machines.py.
|
protected |
Definition at line 624 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 316 of file state_machines.py.
|
protected |
update calibration state
Definition at line 481 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 189 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 260 of file state_machines.py.
automatic_transition | ( | self | ) |
Automatically try all transitions out of this state once. Tries fail last.
Definition at line 671 of file state_machines.py.
|
staticinherited |
Method to always return True.
Definition at line 254 of file state_machines.py.
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 660 of file state_machines.py.
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 485 of file state_machines.py.
|
inherited |
Returns the transition dictionary for a state and transition out of it.
Definition at line 357 of file state_machines.py.
|
inherited |
Returns allowed transitions from a given state.
Definition at line 346 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 205 of file state_machines.py.
|
inherited |
Definition at line 212 of file state_machines.py.
|
inherited |
Does a simple dot file creation to visualise states and transiitons.
Definition at line 368 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 223 of file state_machines.py.
|
inherited |
Definition at line 232 of file state_machines.py.
|
protected |
Results of each iteration for all algorithms of this calibration.
Definition at line 434 of file state_machines.py.
|
protected |
The collector jobs used for submission.
Definition at line 448 of file state_machines.py.
|
protected |
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 445 of file state_machines.py.
|
protectedinherited |
Actual attribute holding initial state for this machine.
Definition at line 182 of file state_machines.py.
|
protected |
Final state of the algorithm runner for the current iteration.
Definition at line 436 of file state_machines.py.
|
protectedinherited |
Actual attribute holding the Current state.
Definition at line 185 of file state_machines.py.
|
static |
output directory of algorithm
Definition at line 394 of file state_machines.py.
calibration = calibration |
Calibration object whose state we are modelling.
Definition at line 425 of file state_machines.py.
collector_backend = None |
Backend used for this calibration machine collector.
Definition at line 432 of file state_machines.py.
|
static |
input directory of collector
Definition at line 390 of file state_machines.py.
|
static |
output directory of collector
Definition at line 392 of file state_machines.py.
default_states |
States that are defaults to the CalibrationMachine
(could override later)
Definition at line 402 of file state_machines.py.
|
inherited |
Pointless docstring since it's a property.
Definition at line 178 of file state_machines.py.
iov_to_calibrate = iov_to_calibrate |
IoV to be executed, currently will loop over all runs in IoV.
Definition at line 438 of file state_machines.py.
iteration = iteration |
Which iteration step are we in.
Definition at line 430 of file state_machines.py.
root_dir = Path(os.getcwd(), calibration.name) |
root directory for this Calibration
Definition at line 440 of file state_machines.py.
|
inherited |
Current State of machine.
Definition at line 332 of file state_machines.py.
|
inherited |
Valid states for this machine.
Definition at line 172 of file state_machines.py.
|
inherited |
Allowed transitions between states.
Definition at line 187 of file state_machines.py.