SND@LHC Software
Loading...
Searching...
No Matches
conditionsDatabase.interface.APIInterface Class Reference

Conditions Database Interface definition. More...

Inheritance diagram for conditionsDatabase.interface.APIInterface:
Collaboration diagram for conditionsDatabase.interface.APIInterface:

Public Member Functions

 list_detectors (self, parent_id=None)
 Returns a list with all the detector names in the database.
 
 get_detector (self, detector_id)
 Returns a detector dictionary.
 
 add_detector (self, name, parent_id=None)
 Adds a new detector to the database.
 
 remove_detector (self, detector_id)
 Removes a detector from the database.
 
 add_condition (self, detector_id, name, tag, values, type=None, collected_at=datetime.now(), valid_since=datetime.now(), valid_until=datetime.max)
 Adds a condition to a detector.
 
 get_conditions (self, detector_id)
 Returns a list with all condition dictionaries associated with a detector.
 
 get_conditions_by_name (self, detector_id, name)
 Returns a list with condition dictionaries having a specific name for a given detector.
 
 get_conditions_by_tag (self, detector_id, tag)
 Returns a list with condition dictionaries having a specific tag for a given detector.
 
 get_conditions_by_name_and_validity (self, detector_id, name, start_date, end_date=None)
 Returns a list with condition dictionaries associated with a detector that are valid on the specified date.
 
 get_condition_by_name_and_tag (self, detector_id, name, tag)
 Returns a condition dictionary of a specific condition belonging to a detector, identified by condition name and tag.
 
 get_condition_by_name_and_collection_date (self, detector_id, name, collected_at)
 Returns a condition dictionary of a specific condition belonging to a detector, identified by condition name and collection date/time.
 
 update_condition_by_name_and_tag (self, detector_id, name, tag, type=None, valid_since=None, valid_until=None)
 Updates the type, valid_since and valid_until values of a specific condition belonging to a detector, identified by condition name and tag.
 

Detailed Description

Conditions Database Interface definition.

This class defines the interface that all storage back-end adapters must implement. TODO uncomment for python >= 3.8: @final

Definition at line 24 of file interface.py.

Member Function Documentation

◆ add_condition()

conditionsDatabase.interface.APIInterface.add_condition (   self,
  detector_id,
  name,
  tag,
  values,
  type = None,
  collected_at = datetime.now(),
  valid_since = datetime.now(),
  valid_until = datetime.max 
)

Adds a condition to a detector.

Parameters
detector_idString identifying the detector to which the condition will be added (i.e. 'muonflux/driftTubes').
nameString specifying the name of the condition (e.g. 'strawPositions').
tagString specifying a tag for the condition. Must be unique for the same condition name.
valuesThe values of the condition. Can be any data type.
type(optional) String specifying the type of condition (e.g. 'calibration').
collected_at(optional) Timestamp specifying the date/time the condition was acquired. Must be unique w.r.t. the condition name. Can be of type String or datetime. This timestamp will be stored with an accuracy up to seconds. If unspecified, this value will be set to 'datetime.now'.
valid_since(optional) Timestamp specifying the date/time as of when the condition is valid. Can be of type String or datetime. This timestamp will be stored with an accuracy up to seconds. If unspecified, this value will be set to 'datetime.now'.
valid_until(optional) Timestamp specifying the date/time up until the condition is valid. Can be of type String or datetime. If unspecified, this value will be set to 'datetime.max'. This timestamp will be stored with an accuracy up to seconds.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 94 of file interface.py.

96 valid_until=datetime.max):
97 pass
98

◆ add_detector()

conditionsDatabase.interface.APIInterface.add_detector (   self,
  name,
  parent_id = None 
)

Adds a new detector to the database.

Parameters
nameString specifying the name for the new detector. Must be unique. Must not contain a forward slash (i.e. /).
parent_id(optional) String identifying the parent detector the new detector should be added to as subdetector.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf parent_id does not exist.

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 57 of file interface.py.

57 def add_detector(self, name, parent_id=None):
58 pass
59

◆ get_condition_by_name_and_collection_date()

conditionsDatabase.interface.APIInterface.get_condition_by_name_and_collection_date (   self,
  detector_id,
  name,
  collected_at 
)

Returns a condition dictionary of a specific condition belonging to a detector, identified by condition name and collection date/time.

This combination must be unique.

Parameters
detector_idString identifying the detector for which the condition must be retrieved (i.e. 'muonflux/driftTubes').
nameString specifying the name of the conditions to be retrieved (e.g. 'strawPositions').
collected_atTimestamp specifying the moment on which the condition was collected/measured. Can be of type String or datetime. Collection dates are stored with accuracy up to seconds.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
DictA dictionary adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 202 of file interface.py.

202 def get_condition_by_name_and_collection_date(self, detector_id, name, collected_at):
203 pass
204

◆ get_condition_by_name_and_tag()

conditionsDatabase.interface.APIInterface.get_condition_by_name_and_tag (   self,
  detector_id,
  name,
  tag 
)

Returns a condition dictionary of a specific condition belonging to a detector, identified by condition name and tag.

This combination must be unique.

Parameters
detector_idString identifying the detector for which the condition must be retrieved (i.e. 'muonflux/driftTubes').
nameString specifying the name of the conditions to be retrieved (e.g. 'strawPositions').
tagString specifying the tag of the condition to be retrieved.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
DictA dictionary adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 182 of file interface.py.

182 def get_condition_by_name_and_tag(self, detector_id, name, tag):
183 pass
184

◆ get_conditions()

conditionsDatabase.interface.APIInterface.get_conditions (   self,
  detector_id 
)

Returns a list with all condition dictionaries associated with a detector.

Parameters
detector_idString identifying the detector for which the conditions must be retrieved (i.e. 'muonflux/driftTubes').
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
ListA list with condition dictionaries adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 110 of file interface.py.

110 def get_conditions(self, detector_id):
111 pass
112

◆ get_conditions_by_name()

conditionsDatabase.interface.APIInterface.get_conditions_by_name (   self,
  detector_id,
  name 
)

Returns a list with condition dictionaries having a specific name for a given detector.

Parameters
detector_idString identifying the detector for which the conditions must be retrieved (i.e. 'muonflux/driftTubes').
nameString specifying the name of the conditions to be retrieved (e.g. 'strawPositions').
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
ListA list with condition dictionaries adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 126 of file interface.py.

126 def get_conditions_by_name(self, detector_id, name):
127 pass
128

◆ get_conditions_by_name_and_validity()

conditionsDatabase.interface.APIInterface.get_conditions_by_name_and_validity (   self,
  detector_id,
  name,
  start_date,
  end_date = None 
)

Returns a list with condition dictionaries associated with a detector that are valid on the specified date.

Parameters
detector_idString identifying the detector for which the condition must be retrieved (i.e. 'muonflux/driftTubes').
nameString specifying the name of the conditions to be retrieved (e.g. 'strawPositions').
start_dateTimestamp specifying a start of a date/time range for which conditions must be valid. Can be of type String or datetime.
end_date(optional) Timestamp specifying the end of a date/time range for which conditions must be valid. If not specified then we will query for validity on the start_date. Can be of type String or datetime
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
ListA list with condition dictionaries adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 165 of file interface.py.

165 def get_conditions_by_name_and_validity(self, detector_id, name, start_date, end_date=None):
166 pass
167

◆ get_conditions_by_tag()

conditionsDatabase.interface.APIInterface.get_conditions_by_tag (   self,
  detector_id,
  tag 
)

Returns a list with condition dictionaries having a specific tag for a given detector.

Parameters
detector_idString identifying the detector for which the condition must be retrieved (i.e. 'muonflux/driftTubes').
tagString specifying the tag of the condition to be retrieved.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
ListA list with condition dictionaries adhering to the following specification: Condition = { 'name': String, 'tag': String, 'type': String, 'collected_at': datetime, 'valid_since': datetime, 'valid_until': datetime, 'values': mixed }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 141 of file interface.py.

141 def get_conditions_by_tag(self, detector_id, tag):
142 pass
143

◆ get_detector()

conditionsDatabase.interface.APIInterface.get_detector (   self,
  detector_id 
)

Returns a detector dictionary.

Parameters
detector_idString identifying the detector to retrieve (i.e. 'muonflux/driftTubes').
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.
Return values
DictA dictionary adhering to the following specification: Detector = { 'name': String, 'subdetectors': List of Detector, 'conditions': List of Condition }

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 46 of file interface.py.

46 def get_detector(self, detector_id):
47 pass
48

◆ list_detectors()

conditionsDatabase.interface.APIInterface.list_detectors (   self,
  parent_id = None 
)

Returns a list with all the detector names in the database.

Parameters
detector_id(optional) String identifying the parent detector to retrieve the (sub)detector names for (i.e. 'muonflux/driftTubes').
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf parent_id does not exist.
Return values
ListA list with (string) names of detectors under the specified parent.

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 34 of file interface.py.

34 def list_detectors(self, parent_id=None):
35 pass
36

◆ remove_detector()

conditionsDatabase.interface.APIInterface.remove_detector (   self,
  detector_id 
)

Removes a detector from the database.

Caution: all conditions associated with this detector will be permanently removed as well!

Parameters
detector_idString identifying the detector to remove (i.e. 'muonflux/driftTubes').
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 67 of file interface.py.

67 def remove_detector(self, detector_id):
68 pass
69

◆ update_condition_by_name_and_tag()

conditionsDatabase.interface.APIInterface.update_condition_by_name_and_tag (   self,
  detector_id,
  name,
  tag,
  type = None,
  valid_since = None,
  valid_until = None 
)

Updates the type, valid_since and valid_until values of a specific condition belonging to a detector, identified by condition name and tag.

Parameters
detector_idString identifying the detector for which the condition must be updated (i.e. 'muonflux/driftTubes').
nameString specifying the name of the conditions to be updated (e.g. 'strawPositions').
tagString specifying the tag of the condition to be updated.
type(optional) String specifying the type of condition (e.g. 'calibration').
valid_since(optional) Timestamp specifying the date/time as of when the condition is valid. Can be of type String or datetime.
valid_until(optional) Timestamp specifying the date/time up until the condition is valid. Can be of type String or datetime.
Exceptions
TypeErrorIf input type is not as specified.
ValueErrorIf detector_id does not exist.

Reimplemented in conditionsDatabase.databases.mongodb.mongodbadapter.MongoToCDBAPIAdapter.

Definition at line 221 of file interface.py.

222 type=None, valid_since=None, valid_until=None):
223 pass

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