Belle II Software  release-06-01-15
CAF Class Reference
Collaboration diagram for CAF:

Public Member Functions

def __init__ (self, calibration_defaults=None)
 
def add_calibration (self, calibration)
 
def run (self, iov=None)
 
def backend (self)
 
def backend (self, backend)
 

Public Attributes

 calibrations
 Dictionary of calibrations for this CAF instance. More...
 
 future_dependencies
 Dictionary of future dependencies of Calibration objects, where the value is all calibrations that will depend on the key, filled during self.run()
 
 dependencies
 Dictionary of dependencies of Calibration objects, where value is the list of Calibration objects that the key depends on. More...
 
 output_dir
 Output path to store results of calibration and bookkeeping information.
 
 order
 The ordering and explicit future dependencies of calibrations. More...
 
 heartbeat
 The heartbeat (seconds) between polling for Calibrations that are finished.
 
 calibration_defaults
 Default options applied to each calibration known to the CAF, if the Calibration has these defined by the user then the defaults aren't applied. More...
 
 backend
 backend property
 

Static Public Attributes

dictionary default_calibration_config
 The defaults for Calibrations. More...
 

Private Member Functions

def _remove_missing_dependencies (self)
 
def _order_calibrations (self)
 
def _check_backend (self)
 
def _prune_invalid_collections (self)
 
def _make_output_dir (self)
 
def _make_database (self)
 

Private Attributes

 _backend
 Private backend attribute.
 
 _db_path
 The path of the SQLite DB.
 

Static Private Attributes

string _db_name = "caf_state.db"
 The name of the SQLite DB that gets created.
 

Detailed Description

Parameters:
  calibration_defaults (dict): A dictionary of default options for calibrations run by this `CAF` instance e.g.

                               >>> calibration_defaults={"max_iterations":2}

This class holds `Calibration` objects and processes them. It defines the initial configuration/setup
for the calibrations. But most of the real processing is done through the `caf.state_machines.CalibrationMachine`.

The `CAF` class essentially does some initial setup, holds the `CalibrationBase` instances and calls the
`CalibrationBase.start` when the dependencies are met.

Much of the checking for consistency is done in this class so that no processing is done with an invalid
setup. Choosing which files to use as input should be done from outside during the setup of the `CAF` and
`CalibrationBase` instances.

Definition at line 1158 of file framework.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  calibration_defaults = None 
)
 

Definition at line 1184 of file framework.py.

Member Function Documentation

◆ _check_backend()

def _check_backend (   self)
private
Makes sure that the CAF has a valid backend setup. If one isn't set by the user (or if the
one that is stored isn't a valid Backend object) we should create a default Local backend.

Definition at line 1299 of file framework.py.

◆ _make_database()

def _make_database (   self)
private
Creates the CAF status database. If it already exists we don't overwrite it.

Definition at line 1464 of file framework.py.

◆ _make_output_dir()

def _make_output_dir (   self)
private
Creates the output directory. If it already exists we are now going to try and restart the program from the last state.

Returns:
    str: The absolute path of the new output_dir

Definition at line 1445 of file framework.py.

◆ _order_calibrations()

def _order_calibrations (   self)
private
- Uses dependency atrributes of calibrations to create a dependency dictionary and passes it
to a sorting algorithm.
- Returns valid OrderedDict if sort was succesful, empty one if it failed (most likely a cyclic dependency)

Definition at line 1255 of file framework.py.

◆ _prune_invalid_collections()

def _prune_invalid_collections (   self)
private
Checks all current calibrations and removes any invalid Collections from their collections list.

Definition at line 1308 of file framework.py.

◆ _remove_missing_dependencies()

def _remove_missing_dependencies (   self)
private
This checks the future and past dependencies of each `Calibration` in the `CAF`.
If any dependencies are not known to the `CAF` then they are removed from the `Calibration`
object directly.

Definition at line 1228 of file framework.py.

◆ add_calibration()

def add_calibration (   self,
  calibration 
)
Adds a `Calibration` that is to be used in this program to the list.
Also adds an empty dependency list to the overall dictionary.
You should not directly alter a `Calibration` object after it has been
added here.

Definition at line 1212 of file framework.py.

◆ backend() [1/2]

def backend (   self)
The `backend <backends.Backend>` that runs the collector job.
When set, this is checked that a `backends.Backend` class instance was passed in.

Definition at line 1429 of file framework.py.

◆ backend() [2/2]

def backend (   self,
  backend 
)
 

Definition at line 1437 of file framework.py.

◆ run()

def run (   self,
  iov = None 
)
Keyword Arguments:
    iov(`caf.utils.IoV`): IoV to calibrate for this processing run. Only the input files necessary to calibrate
                          this IoV will be used in the collection step.

This function runs the overall calibration job, saves the outputs to the output_dir directory,
and creates database payloads.

Upload of final databases is not done here. This simply creates the local databases in
the output directory. You should check the validity of your new local database before uploading
to the conditions DB via the basf2 tools/interface to the DB.

Definition at line 1322 of file framework.py.

Member Data Documentation

◆ calibration_defaults

calibration_defaults

Default options applied to each calibration known to the CAF, if the Calibration has these defined by the user then the defaults aren't applied.

A simple way to define the same configuration to all calibrations in the CAF.

Definition at line 1208 of file framework.py.

◆ calibrations

calibrations

Dictionary of calibrations for this CAF instance.

You should use add_calibration to add to this.

Definition at line 1188 of file framework.py.

◆ default_calibration_config

dictionary default_calibration_config
static
Initial value:
= {
"max_iterations": 5,
"ignored_runs": []
}

The defaults for Calibrations.

Definition at line 1179 of file framework.py.

◆ dependencies

dependencies

Dictionary of dependencies of Calibration objects, where value is the list of Calibration objects that the key depends on.

This attribute is filled during self.run()

Definition at line 1194 of file framework.py.

◆ order

order

The ordering and explicit future dependencies of calibrations.

Will be filled during CAF.run() for you.

Definition at line 1198 of file framework.py.


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