SND@LHC Software
Loading...
Searching...
No Matches
interface.py
Go to the documentation of this file.
1""" Conditions Database interface definition. """
2from abc import ABCMeta, abstractmethod
3from datetime import datetime
4
8
9
10# Package metadata
11__author__ = "Tom Vrancken"
12__email__ = "dev@tomvrancken.nl"
13__copyright__ = "TU/e ST2019"
14__credits__ = ["Juan van der Heijden", "Georgios Azis"]
15__version__ = "1.0"
16__status__ = "Prototype"
17
18
19_ABC = ABCMeta('ABC', (object,), {'__slots__': ()}) # Compatible with python 2 AND 3
20
21
24class APIInterface(_ABC): # For Python 3 we could/should use 'metaclass=ABCMeta'
25
26
33 @abstractmethod
34 def list_detectors(self, parent_id=None):
35 pass
36
37
45 @abstractmethod
46 def get_detector(self, detector_id):
47 pass
48
49
56 @abstractmethod
57 def add_detector(self, name, parent_id=None):
58 pass
59
60
66 @abstractmethod
67 def remove_detector(self, detector_id):
68 pass
69
70
93 @abstractmethod
94 def add_condition(self, detector_id, name, tag, values, type=None,
95 collected_at=datetime.now(), valid_since=datetime.now(),
96 valid_until=datetime.max):
97 pass
98
99
109 @abstractmethod
110 def get_conditions(self, detector_id):
111 pass
112
113
125 @abstractmethod
126 def get_conditions_by_name(self, detector_id, name):
127 pass
128
129
140 @abstractmethod
141 def get_conditions_by_tag(self, detector_id, tag):
142 pass
143
144
164 @abstractmethod
165 def get_conditions_by_name_and_validity(self, detector_id, name, start_date, end_date=None):
166 pass
167
168
181 @abstractmethod
182 def get_condition_by_name_and_tag(self, detector_id, name, tag):
183 pass
184
185
201 @abstractmethod
202 def get_condition_by_name_and_collection_date(self, detector_id, name, collected_at):
203 pass
204
205
220 @abstractmethod
221 def update_condition_by_name_and_tag(self, detector_id, name, tag,
222 type=None, valid_since=None, valid_until=None):
223 pass
Conditions Database Interface definition.
Definition interface.py:24
get_detector(self, detector_id)
Returns a detector dictionary.
Definition interface.py:46
get_conditions_by_tag(self, detector_id, tag)
Returns a list with condition dictionaries having a specific tag for a given detector.
Definition interface.py:141
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 conditi...
Definition interface.py:182
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 conditi...
Definition interface.py:202
add_detector(self, name, parent_id=None)
Adds a new detector to the database.
Definition interface.py:57
remove_detector(self, detector_id)
Removes a detector from the database.
Definition interface.py:67
get_conditions_by_name(self, detector_id, name)
Returns a list with condition dictionaries having a specific name for a given detector.
Definition interface.py:126
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,...
Definition interface.py:222
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...
Definition interface.py:165
list_detectors(self, parent_id=None)
Returns a list with all the detector names in the database.
Definition interface.py:34
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.
Definition interface.py:96
get_conditions(self, detector_id)
Returns a list with all condition dictionaries associated with a detector.
Definition interface.py:110