Belle II Software  release-06-02-00
CalibrationBase Class Reference
Inheritance diagram for CalibrationBase:
Collaboration diagram for CalibrationBase:

Public Member Functions

def __init__ (self, name, input_files=None)
 
def run (self)
 
def is_valid (self)
 
def depends_on (self, calibration)
 
def dependencies_met (self)
 
def failed_dependencies (self)
 

Public Attributes

 name
 Name of calibration object. More...
 
 future_dependencies
 List of calibration objects that depend on this one.
 
 dependencies
 List of calibration objects, where each one is a dependency of this one.
 
 files_to_iovs
 File -> Iov dictionary, should be :

{absolute_file_path:iov}

: Where iov is a :py:class:IoV <caf.utils.IoV> object. More...

 
 input_files
 Files used for collection procedure.
 
 iov
 IoV which will be calibrated. More...
 
 output_database_dir
 The directory where we'll store the local database payloads from this calibration.
 
 save_payloads
 Marks this Calibration as one which has payloads that should be copied and uploaded. More...
 
 jobs_to_submit
 A simple list of jobs that this Calibration wants submitted at some point.
 

Static Public Attributes

string end_state = "completed"
 The name of the successful completion state. More...
 
string fail_state = "failed"
 The name of the failure state. More...
 

Private Member Functions

def _apply_calibration_defaults (self, defaults)
 

Detailed Description

Abstract base class of Calibration types. The CAF implements the :py:class:`Calibration` class which inherits from
this and runs the C++ CalibrationCollectorModule and CalibrationAlgorithm classes. But by inheriting from this
class and providing the minimal necessary methods/attributes you could plug in your own Calibration types
that doesn't depend on the C++ CAF at all and run everything in your own way.

.. warning:: Writing your own class inheriting from :py:class:`CalibrationBase` class is not recommended!
                         But it's there if you really need it.

Parameters:
    name (str): Name of this calibration object. Should be unique if you are going to run it.

Keyword Arguments:
    input_files (list[str]): Input files for this calibration. May contain wildcard expressions useable by `glob.glob`.

Definition at line 298 of file framework.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  input_files = None 
)
 

Definition at line 321 of file framework.py.

Member Function Documentation

◆ _apply_calibration_defaults()

def _apply_calibration_defaults (   self,
  defaults 
)
private
We pass in default calibration options from the `CAF` instance here if called.
Won't overwrite any options already set.

Definition at line 412 of file framework.py.

◆ dependencies_met()

def dependencies_met (   self)
Checks if all of the Calibrations that this one depends on have reached a successful end state.

Definition at line 396 of file framework.py.

◆ depends_on()

def depends_on (   self,
  calibration 
)
Parameters:
    calibration (`CalibrationBase`): The Calibration object which will produce constants that this one depends on.

Adds dependency of this calibration on another i.e. This calibration
will not run until the dependency has completed, and the constants produced
will be used via the database chain.

You can define multiple dependencies for a single calibration simply
by calling this multiple times. Be careful when adding the calibration into
the `CAF` not to add a circular/cyclic dependency. If you do the sort will return an
empty order and the `CAF` processing  will fail.

This function appens to the `CalibrationBase.dependencies` and `CalibrationBase.future_dependencies` attributes of this
`CalibrationBase` and the input one respectively. This prevents us having to do too much recalculation later on.

Definition at line 368 of file framework.py.

◆ failed_dependencies()

def failed_dependencies (   self)
Returns the list of calibrations in our dependency list that have failed.

Definition at line 402 of file framework.py.

◆ is_valid()

def is_valid (   self)
A simple method you should implement that will return True or False depending on whether
the Calibration has been set up correctly and can be run safely.

Reimplemented in Calibration.

Definition at line 362 of file framework.py.

◆ run()

def run (   self)
The most important method. Runs inside a new Thread and is called from `CalibrationBase.start`
once the dependencies of this `CalibrationBase` have returned with state == end_state i.e. "completed".

Reimplemented in Calibration.

Definition at line 355 of file framework.py.

Member Data Documentation

◆ end_state

string end_state = "completed"
static

The name of the successful completion state.

The :py:class:CAF will use this as the state to decide when the Calibration is completed.

Definition at line 316 of file framework.py.

◆ fail_state

string fail_state = "failed"
static

The name of the failure state.

The :py:class:CAF will use this as the state to decide when the Calibration failed.

Definition at line 319 of file framework.py.

◆ files_to_iovs

files_to_iovs

File -> Iov dictionary, should be :

{absolute_file_path:iov}

: Where iov is a :py:class:IoV <caf.utils.IoV> object.

Will be filled during CAF.run() if empty. To improve performance you can fill this yourself before calling CAF.run()

Definition at line 337 of file framework.py.

◆ iov

iov

IoV which will be calibrated.

This is set by the CAF itself when calling CAF.run()

Definition at line 345 of file framework.py.

◆ name

name

Name of calibration object.

This must be unique when adding into the py:class:CAF.

Definition at line 326 of file framework.py.

◆ save_payloads

save_payloads

Marks this Calibration as one which has payloads that should be copied and uploaded.

Defaults to True, and should only be False if this is an intermediate Calibration who's payloads are never needed.

Definition at line 350 of file framework.py.


The documentation for this class was generated from the following file: