![]() |
Belle II Software development
|
Public Member Functions | |
__init__ (self, algorithm) | |
run (self, iov, iteration, queue) | |
setup_from_dict (self, params) | |
is_valid (self) | |
find_iov_gaps (self) | |
any_failed_iov (self) | |
send_result (self, result) | |
send_final_state (self, state) | |
Public Attributes | |
algorithm = algorithm | |
Algorithm() class that we're running. | |
list | input_files = [] |
Collector output files, will contain all files returned by the output patterns. | |
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. | |
list | database_chain = [] |
User defined database chain i.e. | |
list | dependent_databases = [] |
CAF created local databases from previous calibrations that this calibration/algorithm depends on. | |
list | ignored_runs = [] |
Runs that will not be included in ANY execution of the algorithm. | |
list | results = [] |
The list of results objects which will be sent out before the end. | |
queue = None | |
The multiprocessing Queue we use to pass back results one at a time. | |
Static Public Attributes | |
list | required_attrs |
Required attributes that must exist before the strategy can run properly. | |
list | required_true_attrs |
Attributes that must have a value that returns True when tested by :py:meth:is_valid . | |
list | allowed_granularities = ["run", "all"] |
Granularity of collector that can be run by this algorithm properly. | |
str | FINISHED_RESULTS = "DONE" |
Signal value that is put into the Queue when there are no more results left. | |
str | COMPLETED = "COMPLETED" |
Completed state. | |
str | FAILED = "FAILED" |
Failed state. | |
Base class for Algorithm strategies. These do the actual execution of a single algorithm on collected data. Each strategy may be quite different in terms of how fast it may be, how database payloads are passed between executions, and whether or not final payloads have an IoV that is independent to the actual runs used to calculates them. Parameters: algorithm (:py:class:`caf.framework.Algorithm`): The algorithm we will run This base class defines the basic attributes and methods that will be automatically used by the selected AlgorithmRunner. When defining a derived class you are free to use these attributes or to implement as much functionality as you want. If you define your derived class with an __init__ method, then you should first call the base class `AlgorithmStrategy.__init__()` method via super() e.g. >>> def __init__(self): >>> super().__init__() The most important method to implement is :py:meth:`AlgorithmStrategy.run` which will take an algorithm and execute it in the required way defined by the options you have selected/attributes set.
Definition at line 24 of file strategies.py.
__init__ | ( | self, | |
algorithm ) |
Definition at line 76 of file strategies.py.
any_failed_iov | ( | self | ) |
Returns: bool: If any result in the current results list has a failed algorithm code we return True
Definition at line 152 of file strategies.py.
find_iov_gaps | ( | self | ) |
Finds and prints the current gaps between the IoVs of the strategy results. Basically these are the IoVs not covered by any payload. It CANNOT find gaps if they exist across an experiment boundary. Only gaps within the same experiment are found. Returns: iov_gaps(list[IoV])
Definition at line 132 of file strategies.py.
is_valid | ( | self | ) |
Returns: bool: Whether or not this strategy has been set up correctly with all its necessary attributes.
Definition at line 114 of file strategies.py.
run | ( | self, | |
iov, | |||
iteration, | |||
queue ) |
Abstract method that needs to be implemented. It will be called to actually execute the algorithm.
Reimplemented in SequentialBoundaries, SequentialRunByRun, SimpleRunByRun, and SingleIOV.
Definition at line 100 of file strategies.py.
send_final_state | ( | self, | |
state ) |
send final state
Definition at line 176 of file strategies.py.
send_result | ( | self, | |
result ) |
send result
Definition at line 172 of file strategies.py.
setup_from_dict | ( | self, | |
params ) |
Parameters: params (dict): Dictionary containing values to be assigned to the strategy attributes of the same name.
Definition at line 106 of file strategies.py.
algorithm = algorithm |
Algorithm() class that we're running.
Definition at line 80 of file strategies.py.
|
static |
Granularity of collector that can be run by this algorithm properly.
Definition at line 65 of file strategies.py.
|
static |
Completed state.
Definition at line 71 of file strategies.py.
list database_chain = [] |
User defined database chain i.e.
the default global tag, or if you have localdb's/tags for custom alignment etc
Definition at line 88 of file strategies.py.
list dependent_databases = [] |
CAF created local databases from previous calibrations that this calibration/algorithm depends on.
Definition at line 90 of file strategies.py.
|
static |
Failed state.
Definition at line 74 of file strategies.py.
|
static |
Signal value that is put into the Queue when there are no more results left.
Definition at line 68 of file strategies.py.
list ignored_runs = [] |
Runs that will not be included in ANY execution of the algorithm.
Usually set by Calibration.ignored_runs. The different strategies may handle the resulting run gaps differently.
Definition at line 93 of file strategies.py.
list input_files = [] |
Collector output files, will contain all files returned by the output patterns.
Definition at line 82 of file strategies.py.
str output_database_dir = "" |
The output database directory for the localdb that the algorithm will commit to.
Definition at line 86 of file strategies.py.
str output_dir = "" |
The algorithm output directory which is mostly used to store the stdout file.
Definition at line 84 of file strategies.py.
queue = None |
The multiprocessing Queue we use to pass back results one at a time.
Definition at line 97 of file strategies.py.
|
static |
Required attributes that must exist before the strategy can run properly.
Some are allowed be values that return False when tested e.g. "" or []
Definition at line 48 of file strategies.py.
|
static |
Attributes that must have a value that returns True when tested by :py:meth:is_valid
.
Definition at line 58 of file strategies.py.
list results = [] |
The list of results objects which will be sent out before the end.
Definition at line 95 of file strategies.py.