ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
python.db.DefectsDB Class Reference
Inheritance diagram for python.db.DefectsDB:
Collaboration diagram for python.db.DefectsDB:

Public Member Functions

None __init__ (self, str connection_string=DEFAULT_CONNECTION_STRING, bool read_only=True, bool create=False, Union[str, Tuple] tag="HEAD")
 
None __del__ (self)
 
None create_defect (self, str name, str description)
 
IOVSet retrieve (self, Optional[Union[int, Tuple[int, int], RunLumi]] since=None, Optional[Union[int, Tuple[int, int], RunLumi]] until=None, Optional[Iterable[Union[str, int]]] channels=None, bool nonpresent=False, bool primary_only=False, Optional[Collection[str]] ignore=None, bool with_primary_dependencies=False, bool intersect=False, bool with_time=False, bool evaluate_full=True)
 
def storage_buffer (self)
 
None insert (self, Union[str, int] defect_id, int since, int until, str comment, str added_by, bool present=True, bool recoverable=False)
 
def insert_multiple (self, Iterable[IOVType] defect_list, str tag='HEAD', bool use_flask=False, str flask_cool_target='oracle://ATONR_COOLOFL_GPN/ATLAS_COOLOFL_GLOBAL', Mapping[str, str] flask_auth={}, str flask_db='CONDBR2', str flask_uri='https://cool-proxy-app.cern.ch/cool/multi_iovs')
 
None validate_clauses (self, str clauses)
 
None update_virtual_defect (self, str defect_name, str clauses, Optional[str] comment=None)
 
None rename_defect (self, str defect_name, str new_defect_name)
 
int new_virtual_defect (self, str defect_name, Optional[str] comment, str clauses)
 
Set[strresolve_primary_defects (self, Iterable[DefectLogic] defect_logics)
 
Mapping[str, DefectLogic] virtual_defect_logics (self)
 
def get_intolerable_defects (self, bool old_primary_only=True, Sequence[str] exclude=['TIGHT', 'IDTIGHT', 'PHYS_.*'])
 
str logics_tag (self)
 
List[strlogics_tags (self)
 
List[strdefects_tags (self)
 
str next_logics_tag (self)
 
str new_hierarchical_tag (self, str defects_tag, str logics_tag)
 
bool defects_tag_valid (self)
 
bool logics_tag_valid (self)
 
None check_tag_validity (self)
 
str defects_tag (self)
 
tagtype tag (self)
 
List[strtags (self)
 
str new_logics_tag (self, str description="")
 
str new_defects_tag (self, str name, str description, Optional[Iterable] iovranges=None)
 
cool.IFolderSet parent_folderset (self)
 
cool.IFolder defects_folder (self)
 
cool.IFolder defect_logic_folder (self)
 
Set[int] defect_ids (self)
 
Set[strdefect_names (self)
 
MutableMapping[Union[str, int], Union[str, int]] defect_id_map (self)
 
Set[int] virtual_defect_ids (self)
 
Set[strvirtual_defect_names (self)
 
MutableMapping[Union[str, int], Union[str, int]] virtual_defect_id_map (self)
 
int defect_chan_as_id (self, Union[str, int] channel, bool primary_only=False)
 
List[int] defect_names_as_ids (self, Iterable[Union[str, int]] channels)
 
Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]] get_channels (self)
 
Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]] get_virtual_channels (self)
 
MutableMapping[Union[str, int], strget_channel_descriptions (self, Iterable[Union[str, int]] channels)
 
MutableMapping[Union[str, int], strget_virtual_channel_descriptions (self, Iterable[Union[str, int]] channels)
 
Mapping[Union[str, int], strall_defect_descriptions (self)
 
None set_channel_description (self, Union[str, int] channel, str description)
 
bool defect_is_virtual (self, Union[str, int] defect_id)
 
Union[str, List[str]] normalize_defect_names (self, Union[str, Iterable[str]] defect_id)
 

Public Attributes

 connection_string
 
 logics_tag
 
 logics_tag
 

Private Member Functions

None _create_defect_with_id (self, int did, str name, str description)
 
None _insert_iov (self, IOVType iov, str tag)
 
None _insert (self, Union[str, int] defect_id, Union[int, Tuple[int, int], RunLumi] since, Union[int, Tuple[int, int], RunLumi] until, str comment, str added_by, bool present=True, bool recoverable=False, str tag='HEAD')
 
def _insert_multiple_flask (self, Iterable[IOVType] defect_list, str tag, str flask_cool_target, Mapping[str, str] flask_auth, str flask_db, str flask_uri)
 
None _update_virtual_defect (self, str defect_name, str clauses, Optional[str] comment=None, Optional[str] tag=None)
 
List[DefectLogic] _resolve_evaluation_order (self, Optional[Iterable[str]] defects=None)
 
Mapping[str, DefectLogic] _get_virtual_defect_logics (self, str tag)
 
bool _virtual_defect_consistency_check (self)
 
None _tag_head_and_lock (self, cool.IFolder folder, str name, str description)
 
None _clear_connections (self)
 
Tuple[cool.IFolder, cool.Record] _load_folder (self, folder, create_function)
 
None _load_defects_folder (self)
 
cool.IFolder _create_defects_folder (self, cool.IDatabase db)
 
None _load_defect_logic_folder (self)
 
cool.IFolder _create_defect_logic_folder (self, cool.IDatabase db)
 
None _populate_defect_ids (self)
 
None _populate_virtual_defect_ids (self)
 
None _new_defect (self, int did, str dname)
 
None _new_virtual_defect (self, int did, str dname)
 

Private Attributes

 _read_only
 
 _create
 
 _tag
 
 _bad_state
 
 _virtual_defect_logics
 
 _virtual_defect_names
 
 _virtual_defect_id_map
 
 _virtual_initialized
 
 _defect_names
 
 _defect_id_map
 
 _initialized
 
 _defects_folder
 
 _defect_logic_folder
 
 _parent_folderset
 
 _connections
 
 _defect_payload
 
 _defect_logic_payload
 
 _defect_ids
 
 _virtual_defect_ids
 
 _virtual_defect_map
 

Detailed Description

Implementation is split into mixins.

    DefectsDBIDsNamesMixin:
        Defines functions for dealing with defect IDs
    
    DefectsDBFolderMixin:
        Logic for loading or creating the COOL folder/database
    
    DefectsDBFoldersMixin:
        Functions for managing tags
    
    DefectsDBVirtualDefectsMixin:
        Internal code for managing and computing virutal defects
        
Public interface is nominally defined in this class (DefectsDB).

Definition at line 38 of file DQDefects/python/db.py.

Constructor & Destructor Documentation

◆ __init__()

None python.db.DefectsDB.__init__ (   self,
str   connection_string = DEFAULT_CONNECTION_STRING,
bool   read_only = True,
bool   create = False,
Union[str, Tuple]   tag = "HEAD" 
)
Create a new DefectsDB instance.

The COOL folder resides at `DEFECTS_FOLDER`, which is a module-level
varaiable in this module.

Parameters:
    `connection_string` : A COOL connection string, or a string ending 
                  in .db. In the latter case, the database is
                  assumed to be a sqlite database at that path.
    `read_only` : Indicates whether insertions will be disallowed on
          this connection. (Default: True)
    `create`    : If True, attempt to create the database if it doesn't
          exist. (Default: False)
    `tag`       : The COOL tag(s) to use.  Either a single string used
          for both defects and virtual defect logic, or a
          2-tuple (defecttag, logictag).  The default is to
          use HEAD for both defects and logic.  Either
          folder-level or hierarchical tags can be given.

Definition at line 61 of file DQDefects/python/db.py.

61  def __init__(self, connection_string: str = DEFAULT_CONNECTION_STRING,
62  read_only: bool = True, create: bool = False, tag: Union[str, Tuple] = "HEAD") -> None:
63  """
64  Create a new DefectsDB instance.
65 
66  The COOL folder resides at `DEFECTS_FOLDER`, which is a module-level
67  varaiable in this module.
68 
69  Parameters:
70  `connection_string` : A COOL connection string, or a string ending
71  in .db. In the latter case, the database is
72  assumed to be a sqlite database at that path.
73  `read_only` : Indicates whether insertions will be disallowed on
74  this connection. (Default: True)
75  `create` : If True, attempt to create the database if it doesn't
76  exist. (Default: False)
77  `tag` : The COOL tag(s) to use. Either a single string used
78  for both defects and virtual defect logic, or a
79  2-tuple (defecttag, logictag). The default is to
80  use HEAD for both defects and logic. Either
81  folder-level or hierarchical tags can be given.
82  """
83  self.connection_string = connection_string
84  self._read_only = read_only
85  self._create = create
86  if isinstance(tag, six.string_types):
87  self._tag = tagtype(tag, tag) if tag else tagtype("HEAD", "HEAD")
88  else:
89  try:
90  tag = tagtype._make(tag)
91  except Exception:
92  raise TypeError('tag argument must be a 2-element sequence')
93  if len(tag) != 2:
94  raise TypeError('tag argument must be a 2-element sequence')
95  self._tag = tag
96  self._tag = tagtype(self._tag[0],
97  self._tag[1])
98 
99  # COOL has no way of emptying a storage buffer. Creating a new storage
100  # buffer flushes the old one. Therefore, if an exception happens
101  # halfway through setting up a storage buffer, subsequent operations
102  # risk flushing a half-completed operation. In that case, we refuse to
103  # do any more write operations with that database connection.
104  self._bad_state = False
105 
106  super(DefectsDB, self).__init__()
107 
108  if create:
109  # Trigger creation of folders through properties
110  self.defects_folder
111  self.defect_logic_folder
112 

◆ __del__()

None python.db.DefectsDB.__del__ (   self)
Ideally we would use inheritance to call destructors, but this isn't 
possible in the general case with the way we (ab)use mixins, so we just 
do it here.

Definition at line 113 of file DQDefects/python/db.py.

113  def __del__(self) -> None:
114  """
115  Ideally we would use inheritance to call destructors, but this isn't
116  possible in the general case with the way we (ab)use mixins, so we just
117  do it here.
118  """
119  self._clear_connections()
120 

Member Function Documentation

◆ _clear_connections()

None python.folders.DefectsDBFoldersMixin._clear_connections (   self)
privateinherited

Definition at line 29 of file folders.py.

29  def _clear_connections(self) -> None:
30  log.debug("DefectsDB connections cleared")
31  for connection in self._connections:
32  connection.closeDatabase()
33  self._connections = []
34 

◆ _create_defect_logic_folder()

cool.IFolder python.folders.DefectsDBFoldersMixin._create_defect_logic_folder (   self,
cool.IDatabase  db 
)
privateinherited
Creates the COOL database/folder for virtual defect logic, if they don't exist.
Internal - use create=True in the constructor to create the COOL folder.

Definition at line 115 of file folders.py.

115  def _create_defect_logic_folder(self, db: cool.IDatabase) -> cool.IFolder:
116  """
117  Creates the COOL database/folder for virtual defect logic, if they don't exist.
118  Internal - use create=True in the constructor to create the COOL folder.
119  """
120  log.info("Creating defect logic folder")
121 
122  record_spec = cool.RecordSpecification()
123  record_spec.extend("clauses", ST.String4k)
124 
125  folder_spec = cool.FolderSpecification(FV.MULTI_VERSION, record_spec)
126  return db.createFolder(DEFECT_LOGIC_FOLDER, folder_spec,
127  DEFECT_LOGIC_FOLDER_DESC, True)

◆ _create_defect_with_id()

None python.db.DefectsDB._create_defect_with_id (   self,
int  did,
str  name,
str  description 
)
private
Create a new type of defect, specifying the defect ID.
See also: `create_defect`, `new_system_defect`.

Parameters:
    `did` : defect_id
    `name` : name of the defect
    `description` : a human-readable description of the defect

Definition at line 136 of file DQDefects/python/db.py.

136  def _create_defect_with_id(self, did: int, name: str, description: str) -> None:
137  """
138  Create a new type of defect, specifying the defect ID.
139  See also: `create_defect`, `new_system_defect`.
140 
141  Parameters:
142  `did` : defect_id
143  `name` : name of the defect
144  `description` : a human-readable description of the defect
145  """
146  log.info("Creating new defect %s (0x%08x)", name, did)
147  if did in self.defect_ids: raise DefectExistsError(did)
148  try:
149  oldname = self.normalize_defect_names(name)
150  raise DefectExistsError(f'Defect {oldname} already exists')
151  except DefectUnknownError:
152  pass
153 
154  self.defects_folder.createChannel(did,
155  name.encode('ascii'),
156  description.encode('utf-8'))
157  self._new_defect(did, name)
158 

◆ _create_defects_folder()

cool.IFolder python.folders.DefectsDBFoldersMixin._create_defects_folder (   self,
cool.IDatabase  db 
)
privateinherited
Creates the COOL database/folder for defects, if they don't exist.
Internal - use create=True in the constructor to create the COOL folder.

Definition at line 82 of file folders.py.

82  def _create_defects_folder(self, db: cool.IDatabase) -> cool.IFolder:
83  """
84  Creates the COOL database/folder for defects, if they don't exist.
85  Internal - use create=True in the constructor to create the COOL folder.
86  """
87  log.info("Creating defects folder")
88 
89  record_spec = cool.RecordSpecification()
90  record_spec.extend("present", ST.Bool)
91  record_spec.extend("recoverable", ST.Bool)
92  record_spec.extend("user", ST.String255)
93  record_spec.extend("comment", ST.String255)
94 
95  folder_spec = cool.FolderSpecification(FV.MULTI_VERSION, record_spec)
96  return db.createFolder(DEFECTS_FOLDER, folder_spec,
97  DEFECT_FOLDER_DESC, True)
98 

◆ _get_virtual_defect_logics()

Mapping[str, DefectLogic] python.virtual_mixin.DefectsDBVirtualDefectsMixin._get_virtual_defect_logics (   self,
str  tag 
)
privateinherited

Definition at line 233 of file virtual_mixin.py.

233  def _get_virtual_defect_logics(self, tag: str) -> Mapping[str, DefectLogic]:
234  if tag != "HEAD" and not self.defect_logic_folder.existsUserTag(tag.encode('ascii')):
235  # The tag doesn't exist, so there is nothing to fetch.
236  return {}
237 
238  logics = fetch_iovs(self.defect_logic_folder, tag=tag.encode('ascii'),
239  named_channels=True)
240 
241  logics = {l.channel: DefectLogic(l) for l in logics}
242 
243  for _, defect_logic in six.iteritems (logics):
244  defect_logic._populate(logics)
245 
246  return logics
247 

◆ _insert()

None python.db.DefectsDB._insert (   self,
Union[str, int]  defect_id,
Union[int, Tuple[int, int], RunLumi]  since,
Union[int, Tuple[int, int], RunLumi]  until,
str  comment,
str  added_by,
bool   present = True,
bool   recoverable = False,
str   tag = 'HEAD' 
)
private
Implementation of insert, allows tag specification for internal
functions

Definition at line 328 of file DQDefects/python/db.py.

328  def _insert(self, defect_id: Union[str, int], since: Union[int, Tuple[int, int], RunLumi],
329  until: Union[int, Tuple[int, int], RunLumi], comment: str, added_by: str,
330  present: bool = True, recoverable: bool = False, tag: str = 'HEAD') -> None:
331  """
332  Implementation of insert, allows tag specification for internal
333  functions
334  """
335  assert not self._read_only, "Insertion on read-only database"
336  assert not self._bad_state, "Please see comment in DefectsDB constructor"
337 
338  # Force load of defects_folder to populate _defect_payload
339  store = self.defects_folder.storeObject
340  p = self._defect_payload
341 
342  p["present"] = present
343  p["recoverable"] = recoverable
344  p["user"] = added_by.encode('utf-8')
345  p["comment"] = comment.encode('utf-8')
346 
347  defect_id = self.defect_chan_as_id(defect_id, True)
348 
349  store(since, until, p, defect_id, tag.encode('ascii'),
350  (True if tag != 'HEAD' else False))
351 

◆ _insert_iov()

None python.db.DefectsDB._insert_iov (   self,
IOVType  iov,
str  tag 
)
private
Helper function for inserting IOV objects, since record order doesn't
match function argument order

Definition at line 320 of file DQDefects/python/db.py.

320  def _insert_iov(self, iov: IOVType, tag: str) -> None:
321  """
322  Helper function for inserting IOV objects, since record order doesn't
323  match function argument order
324  """
325  return self._insert(iov.channel, iov.since, iov.until, iov.comment,
326  iov.user, iov.present, iov.recoverable, tag)
327 

◆ _insert_multiple_flask()

def python.db.DefectsDB._insert_multiple_flask (   self,
Iterable[IOVType]  defect_list,
str  tag,
str  flask_cool_target,
Mapping[str, str flask_auth,
str  flask_db,
str  flask_uri 
)
private

Definition at line 371 of file DQDefects/python/db.py.

371  def _insert_multiple_flask(self, defect_list: Iterable[IOVType],
372  tag: str,
373  flask_cool_target: str,
374  flask_auth: Mapping[str, str],
375  flask_db: str,
376  flask_uri: str):
377  import requests
378  import json
379  import urllib.parse
380  import os
381  from DQUtils.oracle import get_authentication
382  data = {'grant_type':'client_credentials',
383  'audience': 'cool-flask-server'}
384  data.update(flask_auth)
385  auth = requests.post('https://auth.cern.ch/auth/realms/cern/api-access/token',
386  data=data
387  )
388  if not auth:
389  raise RuntimeError('Cannot authenticate to Flask server')
390  else:
391  token = auth.json()['access_token']
392  log.debug(f'auth succeeded {token}')
393  username, password = get_authentication(flask_cool_target)
394  p = urllib.parse.urlparse(flask_cool_target)
395  if not p.hostname:
396  raise ValueError(f'Cannot interpret {flask_cool_target} as a path')
397  server, schema = p.hostname.upper(), p.path[1:]
398 
399  submit_map = {'cmd': 'addIov',
400  'COOLDEST': flask_cool_target,
401  'ORA_SCHEMA': schema,
402  'ORA_INST': flask_db,
403  'COOLOPTS': 'None',
404  'COOLSINST': flask_db,
405  'ORA_SRV': server,
406  'COOLXP': password,
407  'ORA_USER': username,
408  'cool_data': {
409  'folder': DEFECTS_FOLDER,
410  'description': '',
411  'tag': tag,
412  'record': {'present': 'Bool', 'recoverable': 'Bool',
413  'user': 'String255', 'comment': 'String255'},
414  'size': 0,
415  'iovs': []
416  }}
417 
418  for defect in defect_list:
419  submit_map['cool_data']['iovs'].append(
420  {'channel': self.defect_chan_as_id(defect.channel, True),
421  'since': defect.since,
422  'until': defect.until,
423  'payload': {'present': defect.present,
424  'recoverable': defect.recoverable,
425  'user': defect.user,
426  'comment': defect.comment
427  }
428  }
429  )
430  submit_map['cool_data']['size'] += 1
431  r = requests.post(flask_uri,
432  headers={'Authorization': f'Bearer {token}'},
433  files={'file': ('iov.json',
434  json.dumps({'cool_multi_iov_request': submit_map}))},
435  verify=('DQM_COOL_FLASK_NOVERIFY' not in os.environ)
436  )
437  log.debug(r.content)
438  if not r or r.json()['code'] != 0:
439  raise RuntimeError(f'Unable to upload defects. Flask server returned error:\n{r.json()["message"]}')

◆ _load_defect_logic_folder()

None python.folders.DefectsDBFoldersMixin._load_defect_logic_folder (   self)
privateinherited
Internal function for populating the self._defect_logic_folder variable

Definition at line 107 of file folders.py.

107  def _load_defect_logic_folder(self) -> None:
108  """
109  Internal function for populating the self._defect_logic_folder variable
110  """
111  res = self._load_folder(DEFECT_LOGIC_FOLDER,
112  self._create_defect_logic_folder)
113  self._defect_logic_folder, self._defect_logic_payload = res
114 

◆ _load_defects_folder()

None python.folders.DefectsDBFoldersMixin._load_defects_folder (   self)
privateinherited
Internal function for populating the self._defects_folder variable

Definition at line 74 of file folders.py.

74  def _load_defects_folder(self) -> None:
75  """
76  Internal function for populating the self._defects_folder variable
77  """
78  log.debug("Loading defects folder")
79  res = self._load_folder(DEFECTS_FOLDER, self._create_defects_folder)
80  self._defects_folder, self._defect_payload = res
81 

◆ _load_folder()

Tuple[cool.IFolder, cool.Record] python.folders.DefectsDBFoldersMixin._load_folder (   self,
  folder,
  create_function 
)
privateinherited
Internal function used to load a COOL folder

Definition at line 46 of file folders.py.

46  def _load_folder(self, folder, create_function) -> Tuple[cool.IFolder, cool.Record]:
47  """
48  Internal function used to load a COOL folder
49  """
50  db_folder_string = "%s::%s" % (self.connection_string, folder)
51 
52  if not self._create:
53  create_function = None
54 
55  db, folder = Databases.get_folder(db_folder_string,
56  read_only=self._read_only,
57  create_function=create_function,
58  also_db=True)
59 
60  self._connections.append(db)
61 
62  payload = cool.Record(folder.payloadSpecification())
63 
64  return folder, payload
65 

◆ _new_defect()

None python.ids.DefectsDBIDsNamesMixin._new_defect (   self,
int  did,
str  dname 
)
privateinherited
Internal function used to keep defect IDs/names uptodate.

Definition at line 121 of file ids.py.

121  def _new_defect(self, did: int, dname: str) -> None:
122  """
123  Internal function used to keep defect IDs/names uptodate.
124  """
125  self.defect_ids.add(did)
126  self.defect_names.add(dname)
127  self.defect_id_map[did] = dname
128  self.defect_id_map[dname] = did
129 

◆ _new_virtual_defect()

None python.ids.DefectsDBIDsNamesMixin._new_virtual_defect (   self,
int  did,
str  dname 
)
privateinherited
Internal function used to keep defect IDs/names uptodate.

Definition at line 130 of file ids.py.

130  def _new_virtual_defect(self, did: int, dname: str) -> None:
131  """
132  Internal function used to keep defect IDs/names uptodate.
133  """
134  self.virtual_defect_ids.add(did)
135  self.virtual_defect_names.add(dname)
136  self.virtual_defect_id_map[did] = dname
137  self.virtual_defect_id_map[dname] = did
138  # Reset this so we will reload logic later
139  self._virtual_defect_logics = None
140 

◆ _populate_defect_ids()

None python.ids.DefectsDBIDsNamesMixin._populate_defect_ids (   self)
privateinherited
Called the first time any of defect_{ids,names,id_map,etc} is called,
and populates internal variables to store the channel ids/names for the
life of the DefectsDB instance.

Definition at line 90 of file ids.py.

90  def _populate_defect_ids(self) -> None:
91  """
92  Called the first time any of defect_{ids,names,id_map,etc} is called,
93  and populates internal variables to store the channel ids/names for the
94  life of the DefectsDB instance.
95  """
96  ids, names, mapping = get_channel_ids_names(self.defects_folder)
97  self._defect_ids = set(ids)
98  self._defect_names = set(names)
99  self._defect_id_map = mapping
100 

◆ _populate_virtual_defect_ids()

None python.ids.DefectsDBIDsNamesMixin._populate_virtual_defect_ids (   self)
privateinherited
Called the first time any of virtual_defect_{ids,names,id_map,etc} is called,
and populates internal variables to store the channel ids/names for the
life of the DefectsDB instance.

Definition at line 101 of file ids.py.

101  def _populate_virtual_defect_ids(self) -> None:
102  """
103  Called the first time any of virtual_defect_{ids,names,id_map,etc} is called,
104  and populates internal variables to store the channel ids/names for the
105  life of the DefectsDB instance.
106  """
107  _, _, mapping = get_channel_ids_names(self.defect_logic_folder)
108  try:
109  self._virtual_defect_names = set(self.virtual_defect_logics.keys())
110  self._virtual_defect_ids = set(mapping[name] for name in self._virtual_defect_names)
111  all_defects = self._virtual_defect_names | self._virtual_defect_ids
112  self._virtual_defect_id_map = dict(item for item in mapping.items()
113  if item[0] in all_defects)
114  except InvalidLogicTagError:
115  # Presumably this tag doesn't exist yet, which is ok if we're about
116  # to create some new virtual defects. ?
117  self._virtual_defect_names = set()
118  self._virtual_defect_ids = set()
119  self._virtual_defect_map = {}
120 

◆ _resolve_evaluation_order()

List[DefectLogic] python.virtual_mixin.DefectsDBVirtualDefectsMixin._resolve_evaluation_order (   self,
Optional[Iterable[str]]   defects = None 
)
privateinherited
Returns a list of DefectLogic objects that need to be evaluated, 
in the correct order for them to be consistent.

`defects` should be a list of names

Definition at line 184 of file virtual_mixin.py.

184  def _resolve_evaluation_order(self, defects: Optional[Iterable[str]] = None) -> List[DefectLogic]:
185  """
186  Returns a list of DefectLogic objects that need to be evaluated,
187  in the correct order for them to be consistent.
188 
189  `defects` should be a list of names
190  """
191  if defects is None:
192  logics = self.virtual_defect_logics.items()
193  else:
194  # flags begins as a list of names.
195  # Make it a list of logic objects instead
196  # If it is not in the logics map, the logic is not defined for the
197  # query interval and we shouldn't try to resolve it.
198 
199 
200  logics = [self.virtual_defect_logics[d] for d in defects]
201 
202  class MasterNode(object):
203  dependencies = logics
204 
205  resolved = _resolve_dependencies(MasterNode)
206  resolved.remove(MasterNode)
207  return resolved
208 

◆ _tag_head_and_lock()

None python.tags.DefectsDBTagsMixin._tag_head_and_lock (   self,
cool.IFolder  folder,
str  name,
str  description 
)
privateinherited
Give the current HEAD of `folder` a new tag and lock it.

Definition at line 52 of file tags.py.

52  def _tag_head_and_lock(self, folder: cool.IFolder, name: str, description: str) -> None:
53  """
54  Give the current HEAD of `folder` a new tag and lock it.
55  """
56  LOCKED = cool.HvsTagLock.LOCKED
57  aname = name.encode('ascii')
58  folder.cloneTagAsUserTag('HEAD', aname, description.encode('utf-8'))
59  folder.setTagLockStatus(aname, LOCKED)
60 

◆ _update_virtual_defect()

None python.virtual_mixin.DefectsDBVirtualDefectsMixin._update_virtual_defect (   self,
str  defect_name,
str  clauses,
Optional[str]   comment = None,
Optional[str]   tag = None 
)
privateinherited

Definition at line 63 of file virtual_mixin.py.

63  def _update_virtual_defect(self, defect_name: str, clauses: str,
64  comment: Optional[str] = None, tag: Optional[str] = None) -> None:
65  defect_id = self.defect_chan_as_id(defect_name)
66 
67  assert self.defect_is_virtual(defect_id), ("Tried to update nonvirtual"
68  " defect with update_virtual_defect()")
69 
70  self.validate_clauses(clauses)
71 
72  tag = tag if tag is not None else 'HEAD'
73  ucomment = comment.encode('utf-8') if comment is not None else None
74 
75  self._defect_logic_payload["clauses"] = clauses.encode('ascii')
76 
77  store = self.defect_logic_folder.storeObject
78  store(0, 2**63-1, self._defect_logic_payload, defect_id, tag.encode('ascii'),
79  (True if tag != 'HEAD' else False))
80 
81  if comment is not None:
82  self.defect_logic_folder.setChannelDescription(defect_id, ucomment)
83 

◆ _virtual_defect_consistency_check()

bool python.virtual_mixin.DefectsDBVirtualDefectsMixin._virtual_defect_consistency_check (   self)
privateinherited
When called, uses an assertion to check that there are no missing 
defects. This is a database consistency check which should never be
violated (but was when DQDefects was new).

Definition at line 266 of file virtual_mixin.py.

266  def _virtual_defect_consistency_check(self) -> bool:
267  """
268  When called, uses an assertion to check that there are no missing
269  defects. This is a database consistency check which should never be
270  violated (but was when DQDefects was new).
271  """
272  all_defects = self.defect_names | self.virtual_defect_names
273  used_defects = set()
274 
275  used_by = {}
276  for defect, logic in six.iteritems (self.virtual_defect_logics):
277  used_defects.update(logic.realclauses)
278  for clause in logic.realclauses:
279  used_by.setdefault(clause, []).append(defect)
280 
281  missing_defects = used_defects - all_defects
282 
283  if missing_defects:
284  log.error("-- The missing defects are used by the following virtual defects")
285  log.error("<missing> : <used by>")
286  for missing in missing_defects:
287  log.error(missing + ":" + ", ".join(used_by[missing]))
288 
289  assert not missing_defects, ("The following defects are used but not "
290  "defined anywhere: %r" % missing_defects)
291  return True

◆ all_defect_descriptions()

Mapping[Union[str, int], str] python.ids.DefectsDBIDsNamesMixin.all_defect_descriptions (   self)
inherited
A dictionary of all (virtual and primary) defect descriptions

Definition at line 265 of file ids.py.

265  def all_defect_descriptions(self) -> Mapping[Union[str, int], str]:
266  """
267  A dictionary of all (virtual and primary) defect descriptions
268  """
269  result = self.get_channel_descriptions(self.defect_names)
270  gvcd = self.get_virtual_channel_descriptions
271  result.update(gvcd(self.virtual_defect_names))
272  return result
273 

◆ check_tag_validity()

None python.tags.DefectsDBTagsMixin.check_tag_validity (   self)
inherited
Ensure that the tags that this DefectsDB instance was constructed with
are functional

Definition at line 110 of file tags.py.

110  def check_tag_validity(self) -> None:
111  """
112  Ensure that the tags that this DefectsDB instance was constructed with
113  are functional
114  """
115  if not (self.defects_tag_valid or self.logics_tag_valid):
116  raise InvalidTagError("Tag doesn't resolve: {0}".format(self._tag))
117 

◆ create_defect()

None python.db.DefectsDB.create_defect (   self,
str  name,
str  description 
)
Create a new type of defect; tries to figure out system ID from the
defect name. See also: `create_defect_with_id`, `new_system_defect`.

Parameters:
    `name` : name of the defect
    `description` : a human-readable description of the defect
Returns:
    the ID number of the new defect

Definition at line 121 of file DQDefects/python/db.py.

121  def create_defect(self, name: str, description: str) -> None:
122  """
123  Create a new type of defect; tries to figure out system ID from the
124  defect name. See also: `create_defect_with_id`, `new_system_defect`.
125 
126  Parameters:
127  `name` : name of the defect
128  `description` : a human-readable description of the defect
129  Returns:
130  the ID number of the new defect
131  """
132  sysid = choose_new_defect_id(self.defect_id_map, name)
133  log.info("Creating new defect %s: system ID %08x", name, sysid)
134  self._create_defect_with_id(sysid, name, description)
135 

◆ defect_chan_as_id()

int python.ids.DefectsDBIDsNamesMixin.defect_chan_as_id (   self,
Union[str, int]  channel,
bool   primary_only = False 
)
inherited
Returns the defect ID for a virtual defect.
Accepts a `channel` as an integer/string and returns it as an integer.

Will raise DefectUnknownError if `channel` is an unknown ID or string.

This function first checks against non-virtual defects, then virutal 
defects. Thus virtual-defects are lazily loaded.        

Definition at line 203 of file ids.py.

203  def defect_chan_as_id(self, channel: Union[str, int], primary_only: bool = False) -> int:
204  """
205  Returns the defect ID for a virtual defect.
206  Accepts a `channel` as an integer/string and returns it as an integer.
207 
208  Will raise DefectUnknownError if `channel` is an unknown ID or string.
209 
210  This function first checks against non-virtual defects, then virutal
211  defects. Thus virtual-defects are lazily loaded.
212  """
213  from builtins import int
214  if isinstance(channel, int):
215  if (channel not in self.defect_ids and
216  (not primary_only and channel not in self.virtual_defect_ids)):
217  raise DefectUnknownError(channel)
218  return channel
219  elif isinstance(channel, six.string_types):
220  if channel in self.defect_names:
221  return self.defect_id_map[channel]
222  if not primary_only and channel in self.virtual_defect_names:
223  return self.virtual_defect_id_map[channel]
224  raise DefectUnknownError(channel)
225  raise RuntimeError("Invalid `channel` type, got %s, expected integer"
226  " or string" % type(channel))
227 

◆ defect_id_map()

MutableMapping[Union[str,int], Union[str,int]] python.ids.DefectsDBIDsNamesMixin.defect_id_map (   self)
inherited
Gives the dictionary relating COOL channel ids to defect names and vice
versa, retrieving them from the database if necessary.

Definition at line 163 of file ids.py.

163  def defect_id_map(self) -> MutableMapping[Union[str,int], Union[str,int]]:
164  """
165  Gives the dictionary relating COOL channel ids to defect names and vice
166  versa, retrieving them from the database if necessary.
167  """
168  if not self._initialized:
169  self._populate_defect_ids()
170  self._initialized = True
171  return self._defect_id_map
172 

◆ defect_ids()

Set[int] python.ids.DefectsDBIDsNamesMixin.defect_ids (   self)
inherited
Gives the set of defect IDs that exist in COOL

Definition at line 142 of file ids.py.

142  def defect_ids(self) -> Set[int]:
143  """
144  Gives the set of defect IDs that exist in COOL
145  """
146  if not self._initialized:
147  self._populate_defect_ids()
148  self._initialized = True
149  return self._defect_ids
150 

◆ defect_is_virtual()

bool python.ids.DefectsDBIDsNamesMixin.defect_is_virtual (   self,
Union[str, int]  defect_id 
)
inherited
Returns True if the `defect_id` represents a virtual defect, False if it 
is not and raises if it doesn't exist

Parameters:
    `defect_id` : defect channel id or name

Definition at line 285 of file ids.py.

285  def defect_is_virtual(self, defect_id: Union[str, int]) -> bool:
286  """
287  Returns True if the `defect_id` represents a virtual defect, False if it
288  is not and raises if it doesn't exist
289 
290  Parameters:
291  `defect_id` : defect channel id or name
292  """
293  from builtins import int
294  if isinstance(defect_id, int):
295  return DefectID(defect_id).is_virtual
296 
297  if not isinstance(defect_id, six.string_types):
298  raise RuntimeError("Invalid defect_id, expected int or string")
299 
300  if defect_id in self.defect_names:
301  return False
302 
303  if defect_id in self.virtual_defect_names:
304  return True
305 
306  raise DefectUnknownError(defect_id)
307 

◆ defect_logic_folder()

cool.IFolder python.folders.DefectsDBFoldersMixin.defect_logic_folder (   self)
inherited
Returns the folder containing the virtual defect logic, loading it if necessary

Definition at line 100 of file folders.py.

100  def defect_logic_folder(self) -> cool.IFolder:
101  """
102  Returns the folder containing the virtual defect logic, loading it if necessary
103  """
104  if self._defect_logic_folder is None: self._load_defect_logic_folder()
105  return self._defect_logic_folder
106 

◆ defect_names()

Set[str] python.ids.DefectsDBIDsNamesMixin.defect_names (   self)
inherited
Gives the set of defect names that exist in COOL

Definition at line 152 of file ids.py.

152  def defect_names(self) -> Set[str]:
153  """
154  Gives the set of defect names that exist in COOL
155  """
156  if not self._initialized:
157  self._populate_defect_ids()
158  self._initialized = True
159  assert self._defect_names is not None, self._initialized
160  return self._defect_names
161 

◆ defect_names_as_ids()

List[int] python.ids.DefectsDBIDsNamesMixin.defect_names_as_ids (   self,
Iterable[Union[str, int]]  channels 
)
inherited
Returns a list of channels as IDs

Definition at line 228 of file ids.py.

228  def defect_names_as_ids(self, channels: Iterable[Union[str, int]]) -> List[int]:
229  """
230  Returns a list of channels as IDs
231  """
232  return [self.defect_chan_as_id(chan) for chan in channels]
233 

◆ defects_folder()

cool.IFolder python.folders.DefectsDBFoldersMixin.defects_folder (   self)
inherited
Returns the folder containing the defects, loading it if necessary

Definition at line 67 of file folders.py.

67  def defects_folder(self) -> cool.IFolder:
68  """
69  Returns the folder containing the defects, loading it if necessary
70  """
71  if self._defects_folder is None: self._load_defects_folder()
72  return self._defects_folder
73 

◆ defects_tag()

str python.tags.DefectsDBTagsMixin.defects_tag (   self)
inherited
Return the tag used for retrieving defects on this DefectsDB instance

Definition at line 119 of file tags.py.

119  def defects_tag(self) -> str:
120  """
121  Return the tag used for retrieving defects on this DefectsDB instance
122  """
123  if self._tag.defects == "HEAD": return "HEAD"
124  try:
125  return self.defects_folder.resolveTag(self._tag.defects)
126  except Exception:
127  if self._read_only:
128  raise InvalidDefectTagError(self._tag.defects)
129  # assume user knows what they're doing (e.g. writing to fresh tag)
130  return self._tag.defects
131 

◆ defects_tag_valid()

bool python.tags.DefectsDBTagsMixin.defects_tag_valid (   self)
inherited

Definition at line 93 of file tags.py.

93  def defects_tag_valid(self) -> bool:
94  try:
95  self.defects_tag
96  except InvalidTagError:
97  return False
98  else:
99  return True
100 

◆ defects_tags()

List[str] python.tags.DefectsDBTagsMixin.defects_tags (   self)
inherited
Returns a list of existing defect tags

Definition at line 34 of file tags.py.

34  def defects_tags(self) -> List[str]:
35  """
36  Returns a list of existing defect tags
37  """
38  return [str(t) for t in self.defects_folder.listTags()]
39 

◆ get_channel_descriptions()

MutableMapping[Union[str, int], str] python.ids.DefectsDBIDsNamesMixin.get_channel_descriptions (   self,
Iterable[Union[str, int]]  channels 
)
inherited
For the list of channel IDs "channels", return dict mapping ID to
description

Definition at line 246 of file ids.py.

246  def get_channel_descriptions(self, channels: Iterable[Union[str, int]]) -> MutableMapping[Union[str, int], str]:
247  """
248  For the list of channel IDs "channels", return dict mapping ID to
249  description
250  """
251  get_desc = self.defects_folder.channelDescription
252  return {channel: get_desc(self.defect_chan_as_id(channel))
253  for channel in channels}
254 

◆ get_channels()

Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]] python.ids.DefectsDBIDsNamesMixin.get_channels (   self)
inherited
Return channel IDs, names, and dict relating the two

Definition at line 234 of file ids.py.

234  def get_channels(self) -> Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]]:
235  """
236  Return channel IDs, names, and dict relating the two
237  """
238  return self.defect_ids, self.defect_names, self.defect_id_map
239 

◆ get_intolerable_defects()

def python.virtual_mixin.DefectsDBVirtualDefectsMixin.get_intolerable_defects (   self,
bool   old_primary_only = True,
Sequence[str]   exclude = ['TIGHT', 'IDTIGHT', 'PHYS_.*'] 
)
inherited
Returns primary defects that are depended on by a virtual defect
if old_primary_only == True, only return those depended on by a
virtual defect with no _ in the name
ignores virtual defects in exclude list
accepts regexes in exclude list

Definition at line 248 of file virtual_mixin.py.

248  def get_intolerable_defects(self, old_primary_only: bool = True,
249  exclude: Sequence[str] = ['TIGHT', 'IDTIGHT', 'PHYS_.*']):
250  """
251  Returns primary defects that are depended on by a virtual defect
252  if old_primary_only == True, only return those depended on by a
253  virtual defect with no _ in the name
254  ignores virtual defects in exclude list
255  accepts regexes in exclude list
256  """
257  vdl = self.virtual_defect_logics
258  if old_primary_only:
259  vdl = dict(l for l in vdl.items() if '_' not in l[0])
260  if len(exclude) > 0:
261  import re
262  rex = re.compile('(%s)' % '|'.join(exclude))
263  vdl = dict(l for l in vdl.items() if not rex.match(l[0]))
264  return self.resolve_primary_defects(vdl.values())
265 

◆ get_virtual_channel_descriptions()

MutableMapping[Union[str, int], str] python.ids.DefectsDBIDsNamesMixin.get_virtual_channel_descriptions (   self,
Iterable[Union[str, int]]  channels 
)
inherited
For the list of channel IDs "channels", return dict mapping ID to
descriptiondefect_id

Definition at line 255 of file ids.py.

255  def get_virtual_channel_descriptions(self, channels: Iterable[Union[str, int]]) -> MutableMapping[Union[str, int], str]:
256  """
257  For the list of channel IDs "channels", return dict mapping ID to
258  descriptiondefect_id
259  """
260  get_desc = self.defect_logic_folder.channelDescription
261  return {channel: get_desc(self.defect_chan_as_id(channel))
262  for channel in channels}
263 

◆ get_virtual_channels()

Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]] python.ids.DefectsDBIDsNamesMixin.get_virtual_channels (   self)
inherited
Return channel IDs, names, and dict relating the two

Definition at line 240 of file ids.py.

240  def get_virtual_channels(self) -> Tuple[Set[int], Set[str], Mapping[Union[str, int], Union[str, int]]]:
241  """
242  Return channel IDs, names, and dict relating the two
243  """
244  return self.virtual_defect_ids, self.virtual_defect_names, self.virtual_defect_id_map
245 

◆ insert()

None python.db.DefectsDB.insert (   self,
Union[str, int]  defect_id,
int  since,
int  until,
str  comment,
str  added_by,
bool   present = True,
bool   recoverable = False 
)
Insert a new defect into the database.

Parameters:
    `defect_id` : The name or channel identifier for the deect
    `since`, `until` : The COOL IoV for the range
    `comment`   : String255 arbitrary text comment
    `added_by`  : The user name or "sys:"-prefixed string of the
          application that inserted the defect
    `present`   : The state of the flag (Default: True)
    `recoverable` : Indicates whether there is any possibility to set
            present=False in the future (Default: False)

Definition at line 302 of file DQDefects/python/db.py.

302  def insert(self, defect_id: Union[str, int], since: int, until: int, comment: str, added_by: str,
303  present: bool = True, recoverable: bool = False) -> None:
304  """
305  Insert a new defect into the database.
306 
307  Parameters:
308  `defect_id` : The name or channel identifier for the deect
309  `since`, `until` : The COOL IoV for the range
310  `comment` : String255 arbitrary text comment
311  `added_by` : The user name or "sys:"-prefixed string of the
312  application that inserted the defect
313  `present` : The state of the flag (Default: True)
314  `recoverable` : Indicates whether there is any possibility to set
315  present=False in the future (Default: False)
316  """
317  return self._insert(defect_id, since, until, comment, added_by,
318  present, recoverable, self.defects_tag)
319 

◆ insert_multiple()

def python.db.DefectsDB.insert_multiple (   self,
Iterable[IOVType]  defect_list,
str   tag = 'HEAD',
bool   use_flask = False,
str   flask_cool_target = 'oracle://ATONR_COOLOFL_GPN/ATLAS_COOLOFL_GLOBAL',
Mapping[str, str]   flask_auth = {},
str   flask_db = 'CONDBR2',
str   flask_uri = 'https://cool-proxy-app.cern.ch/cool/multi_iovs' 
)

Definition at line 352 of file DQDefects/python/db.py.

352  def insert_multiple(self, defect_list: Iterable[IOVType],
353  tag: str = 'HEAD', use_flask: bool = False,
354  flask_cool_target: str = 'oracle://ATONR_COOLOFL_GPN/ATLAS_COOLOFL_GLOBAL',
355  flask_auth: Mapping[str, str] = {},
356  flask_db: str = 'CONDBR2',
357  flask_uri: str = 'https://cool-proxy-app.cern.ch/cool/multi_iovs'
358  ):
359  if not use_flask:
360  for defect in defect_list:
361  self._insert_iov(defect, tag)
362  else:
363  # Allow for override from environment
364  import os
365  flask_uri = os.environ.get('DQM_COOL_FLASK_URI', flask_uri)
366 
367  log.debug(f'Flask server URI: {flask_uri}')
368  self._insert_multiple_flask(defect_list, tag, flask_cool_target,
369  flask_auth, flask_db, flask_uri)
370 

◆ logics_tag()

str python.tags.DefectsDBTagsMixin.logics_tag (   self)
inherited
Return the tag used for retrieving virtual defect clauses

Definition at line 133 of file tags.py.

133  def logics_tag(self) -> str:
134  """
135  Return the tag used for retrieving virtual defect clauses
136  """
137  if self._tag.logic == "HEAD": return "HEAD"
138  try:
139  return self.defect_logic_folder.resolveTag(self._tag.logic)
140  except Exception:
141  if self._read_only:
142  raise InvalidLogicTagError(self._tag.logic)
143  # assume user knows what they're doing (e.g. writing to fresh tag)
144  return self._tag.logic
145 

◆ logics_tag_valid()

bool python.tags.DefectsDBTagsMixin.logics_tag_valid (   self)
inherited

Definition at line 102 of file tags.py.

102  def logics_tag_valid(self) -> bool:
103  try:
104  self.logics_tag
105  except InvalidTagError:
106  return False
107  else:
108  return True
109 

◆ logics_tags()

List[str] python.tags.DefectsDBTagsMixin.logics_tags (   self)
inherited
Returns a list of existing logic tags

Definition at line 27 of file tags.py.

27  def logics_tags(self) -> List[str]:
28  """
29  Returns a list of existing logic tags
30  """
31  return [str(t) for t in self.defect_logic_folder.listTags()]
32 

◆ new_defects_tag()

str python.tags.DefectsDBTagsMixin.new_defects_tag (   self,
str  name,
str  description,
Optional[Iterable]   iovranges = None 
)
inherited
Clones the current DEFECTS tag (specified in the constructor) to a new one
If iovranges != None, does the slower thing of copying IOVs one by one

Parameters:
    `name` : Name of the new tag
    `description` : Description of the contents of this tag

Definition at line 175 of file tags.py.

175  def new_defects_tag(self, name: str, description: str, iovranges: Optional[Iterable] = None) -> str:
176  """
177  Clones the current DEFECTS tag (specified in the constructor) to a new one
178  If iovranges != None, does the slower thing of copying IOVs one by one
179 
180  Parameters:
181  `name` : Name of the new tag
182  `description` : Description of the contents of this tag
183  """
184  if name.startswith("DetStatus"):
185  raise RuntimeError("Only specify the last part of the defect tag")
186  adescription = description.encode('utf-8')
187 
188  log.info("Creating new tag %s", name)
189 
190  name = f"DetStatusDEFECTS-{name}"
191  aname = name.encode('ascii')
192 
193  if iovranges is None:
194  self.defects_folder.cloneTagAsUserTag(self.defects_tag.encode('ascii'), aname, adescription)
195  return name
196 
197  # Fetch all primary defects relevant to `iovranges`
198  kwargs = dict(primary_only=True, nonpresent=True, intersect=True)
199  iovsets = (self.retrieve(*iovrange, **kwargs) for iovrange in iovranges)
200  to_copy = IOVSet.from_iovsets(iovsets)
201 
202  log.info("Copying IoVs: %r", to_copy)
203 
204  with self.storage_buffer:
205  for iov in to_copy:
206  self._insert_iov(iov, name)
207 
208  # If there are no IOVs to copy, there is no new tag to describe
209  if to_copy:
210  self.defects_folder.setTagDescription(aname, adescription)
211 
212  return name

◆ new_hierarchical_tag()

str python.tags.DefectsDBTagsMixin.new_hierarchical_tag (   self,
str  defects_tag,
str  logics_tag 
)
inherited
Create a new heirarchical tag relating the defects and logics

New tag is of the form
"DetStatus-[Logic revision number]-[Defect tagname]"
and has description
"(v%i) blah"

Definition at line 61 of file tags.py.

61  def new_hierarchical_tag(self, defects_tag: str, logics_tag: str) -> str:
62  """
63  Create a new heirarchical tag relating the defects and logics
64 
65  New tag is of the form
66  "DetStatus-[Logic revision number]-[Defect tagname]"
67  and has description
68  "(v%i) blah"
69  """
70  logic_revision = int(logics_tag.split("-")[-1])
71  defect_part = "-".join(defects_tag.split("-")[1:])
72  hierarchical_tag = "DetStatus-v%02i-%s" % (logic_revision, defect_part)
73  logicspart = "(%i) " % logic_revision
74 
75  adefects_tag = defects_tag.encode('ascii')
76  alogics_tag = logics_tag.encode('ascii')
77  ahierarchical_tag = hierarchical_tag.encode('ascii')
78  logicspart = logicspart.encode('ascii')
79  defect_descr = self.defects_folder.tagDescription(adefects_tag).encode('utf-8')
80 
81  # Protection here against making descriptions too long
82  description = logicspart + defect_descr[:255 - len(logicspart)]
83 
84  parent_folder = self.parent_folderset
85  self.defects_folder.createTagRelation(ahierarchical_tag, adefects_tag)
86  self.defect_logic_folder.createTagRelation(ahierarchical_tag, alogics_tag)
87  parent_folder.setTagDescription(ahierarchical_tag, description)
88 
89  log.info("New hierarchical tag %s", hierarchical_tag)
90  return hierarchical_tag
91 

◆ new_logics_tag()

str python.tags.DefectsDBTagsMixin.new_logics_tag (   self,
str   description = "" 
)
inherited
Create a new tag for the logic folder and lock it.

Parameters:
    `description` : What changed in this tag? (optional, default "")

Definition at line 160 of file tags.py.

160  def new_logics_tag(self, description: str = "") -> str:
161  """
162  Create a new tag for the logic folder and lock it.
163 
164  Parameters:
165  `description` : What changed in this tag? (optional, default "")
166  """
167  assert self.logics_tag == "HEAD", NONHEAD_MODIFICATION_MSG
168 
169  new_tag_name = self.next_logics_tag
170  folder = self.defect_logic_folder
171  self._tag_head_and_lock(folder, new_tag_name, description)
172  log.info("Tagged DEFECTLOGICS HEAD with %s", new_tag_name)
173  return new_tag_name
174 

◆ new_virtual_defect()

int python.virtual_mixin.DefectsDBVirtualDefectsMixin.new_virtual_defect (   self,
str  defect_name,
Optional[str comment,
str  clauses 
)
inherited
Create a new virtual defect

Definition at line 149 of file virtual_mixin.py.

149  def new_virtual_defect(self, defect_name: str, comment: Optional[str], clauses: str) -> int:
150  """
151  Create a new virtual defect
152  """
153  assert self.logics_tag == "HEAD", NONHEAD_MODIFICATION_MSG
154  assert not self._read_only, "Insertion on read-only database"
155  from DQUtils.channel_mapping import get_channel_ids_names
156 
157  # Force load of defects_folder to populate _defect_payload
158  store = self.defect_logic_folder.storeObject
159  p = self._defect_logic_payload
160 
161  self.validate_clauses(clauses)
162 
163  p["clauses"] = clauses.encode('ascii')
164 
165  # need to get true mapping of folder, not just what is visible
166  # from this tag
167  ids, _, mapping = get_channel_ids_names(self.defect_logic_folder)
168  defect_id = choose_new_defect_id(mapping, defect_name, True)
169  log.debug("Creating new defect %s: 0x%08x", defect_name, defect_id)
170 
171  try:
172  oldname = self.normalize_defect_names(defect_name)
173  raise DefectExistsError('Defect %s already exists' % oldname)
174  except DefectUnknownError:
175  pass
176 
177  if (defect_id in ids):
178  raise DefectExistsError(defect_name)
179  self.defect_logic_folder.createChannel(defect_id, defect_name.encode('ascii'), comment.encode('utf-8'))
180  store(0, 2**63-1, p, defect_id)
181  self._new_virtual_defect(defect_id, defect_name)
182  return defect_id
183 

◆ next_logics_tag()

str python.tags.DefectsDBTagsMixin.next_logics_tag (   self)
inherited
Gives the next available DEFECTLOGICS tag

Definition at line 41 of file tags.py.

41  def next_logics_tag(self) -> str:
42  """
43  Gives the next available DEFECTLOGICS tag
44  """
45  existing_tags = self.logics_tags
46  if existing_tags:
47  new_id = max(int(str(t).split("-")[-1]) for t in existing_tags) + 1
48  else:
49  new_id = 0
50  return DEFECT_LOGIC_TAG_FORMAT % new_id
51 

◆ normalize_defect_names()

Union[str, List[str]] python.ids.DefectsDBIDsNamesMixin.normalize_defect_names (   self,
Union[str, Iterable[str]]  defect_id 
)
inherited
Returns correct name(s) of defects, given name(s) that possibly differ
from the correct ones by case.  Raises if an input name doesn't map to
any existing defect.  You can pass either a string or an iterable
object as `defect_id`.

Definition at line 308 of file ids.py.

308  def normalize_defect_names(self, defect_id: Union[str, Iterable[str]]) -> Union[str, List[str]]:
309  """
310  Returns correct name(s) of defects, given name(s) that possibly differ
311  from the correct ones by case. Raises if an input name doesn't map to
312  any existing defect. You can pass either a string or an iterable
313  object as `defect_id`.
314  """
315  wasstring = False
316  if isinstance(defect_id, six.string_types):
317  defect_id = [defect_id]
318  wasstring = True
319  if any(not isinstance(i, six.string_types) for i in defect_id):
320  raise ValueError('All input values must be strings')
321 
322  uppered_defects = dict((i.upper(), i) for i in self.defect_names)
323  uppered_defects.update(dict((i.upper(), i) for i in self.virtual_defect_names))
324 
325  rv = []
326  for i in defect_id:
327  up = i.upper()
328  if up in uppered_defects:
329  rv.append(uppered_defects[up])
330  else:
331  raise DefectUnknownError(i)
332 
333  if wasstring:
334  return rv[0]
335  else:
336  return rv

◆ parent_folderset()

cool.IFolderSet python.folders.DefectsDBFoldersMixin.parent_folderset (   self)
inherited
Lazy-loads parent folderset (useful for heirarchical tag manipulation)

Definition at line 36 of file folders.py.

36  def parent_folderset(self) -> cool.IFolderSet:
37  """
38  Lazy-loads parent folderset (useful for heirarchical tag manipulation)
39  """
40  if self._parent_folderset is None:
41  db = Databases.get_instance(self.connection_string,
42  read_only=self._read_only)
43  self._parent_folderset = db.getFolderSet(PARENT_FOLDERSET)
44  return self._parent_folderset
45 

◆ rename_defect()

None python.virtual_mixin.DefectsDBVirtualDefectsMixin.rename_defect (   self,
str  defect_name,
str  new_defect_name 
)
inherited
Rename a defect (primary or virtual).  Will keep data and channel ID.
Will fix up all virtual defect dependencies in all tags.

Definition at line 84 of file virtual_mixin.py.

84  def rename_defect(self, defect_name: str, new_defect_name: str) -> None:
85  """
86  Rename a defect (primary or virtual). Will keep data and channel ID.
87  Will fix up all virtual defect dependencies in all tags.
88  """
89  assert not self._read_only, "Channel rename on read-only database"
90 
91  try:
92  oldname = self.normalize_defect_names(new_defect_name)
93  raise DefectExistsError('Defect %s already exists' % oldname)
94  except DefectUnknownError:
95  pass
96 
97  defect_id = self.defect_chan_as_id(defect_name)
98 
99  anew_defect_name = new_defect_name.encode('ascii')
100  if self.defect_is_virtual(defect_id):
101  self.defect_logic_folder.setChannelName(defect_id, anew_defect_name)
102  self._virtual_defect_names = set()
103  self._virtual_defect_id_map = {}
104  self._virtual_defect_logics = None
105  self._virtual_initialized = False
106  else:
107  self.defects_folder.setChannelName(defect_id, anew_defect_name)
108  self._defect_names = set()
109  self._defect_id_map = {}
110  self._initialized = False
111 
112  import contextlib
113  @contextlib.contextmanager
114  def logics_unlocking(tag):
115  atag = tag.encode('ascii')
116  log.info('Unlocking tag %s', tag)
117  folder = self.defect_logic_folder
118  orig_status = folder.tagLockStatus(atag)
119  if orig_status != 0:
120  folder.setTagLockStatus(atag, 0)
121  yield
122  if orig_status != 0:
123  folder.setTagLockStatus(atag, orig_status)
124  log.info('Done with tag %s', tag)
125 
126  def logic_substitute(clause, oldname, newname):
127  oclause = clause
128  prefix = ''
129  if clause[0] in ('!',):
130  prefix = clause[0]
131  clause = clause[1:]
132  if clause != oldname:
133  return oclause
134  else:
135  return prefix + newname
136 
137  for tag in ['HEAD'] + self.logics_tags:
138  logics = self._get_virtual_defect_logics(tag)
139  for vd, logic in logics.items():
140  if defect_name in logic.realclauses:
141  newclauses = ' '.join([logic_substitute(x, defect_name,
142  new_defect_name)
143  for x in logic.clauses
144  ])
145  with logics_unlocking(tag):
146  self._update_virtual_defect(vd, newclauses, tag=tag)
147  self._virtual_defect_logics = None
148 

◆ resolve_primary_defects()

Set[str] python.virtual_mixin.DefectsDBVirtualDefectsMixin.resolve_primary_defects (   self,
Iterable[DefectLogic defect_logics 
)
inherited
Determine which primary flags are used for 
a given list of input `virtual_defect_names`.

Definition at line 209 of file virtual_mixin.py.

209  def resolve_primary_defects(self, defect_logics: Iterable[DefectLogic]) -> Set[str]:
210  """
211  Determine which primary flags are used for
212  a given list of input `virtual_defect_names`.
213  """
214  primary_defects = set()
215  for defect_logic in defect_logics:
216  primary_defects |= defect_logic.primary_defects
217 
218  return primary_defects
219 

◆ retrieve()

IOVSet python.db.DefectsDB.retrieve (   self,
Optional[Union[int, Tuple[int,int], RunLumi]]   since = None,
Optional[Union[int, Tuple[int,int], RunLumi]]   until = None,
Optional[Iterable[Union[str,int]]]   channels = None,
bool   nonpresent = False,
bool   primary_only = False,
Optional[Collection[str]]   ignore = None,
bool   with_primary_dependencies = False,
bool   intersect = False,
bool   with_time = False,
bool   evaluate_full = True 
)
Retrieve defects from the database.

Parameters:
    `since`, `until` : IoV range to query (Default: All)
    `channels`  : A list of channels to query. Can contain a mixture of
         defect names and ids. (Default: None means all 
        channels, including all virtual)
    `nonpresent` : Only return IoVs which are currently "present"
    `primary_only` : Only return primary IoVs, no virtual ones.
    `ignore` : Set of defects which won't be treated as bad.
    `with_primary_dependencies` : When querying virtual flags, also get
primary flags which went into the calculation.
    `intersect` : Intersect the result with the query range so that no
          iov spans outside the query range
    `with_time` : Also retrieves the time the defect was inserted
          ~2x slower queries, doesn't work for virtual defects
    `evaluate_full` : If specified, also compute the `comment` and
              `recoverable` fields of virtual defects.
              Causes a ~0.6x slowdown

Definition at line 159 of file DQDefects/python/db.py.

159  def retrieve(self, since: Optional[Union[int, Tuple[int,int], RunLumi]] = None,
160  until: Optional[Union[int, Tuple[int,int], RunLumi]] = None,
161  channels: Optional[Iterable[Union[str,int]]] = None, nonpresent: bool = False,
162  primary_only: bool = False, ignore: Optional[Collection[str]] = None,
163  with_primary_dependencies: bool = False, intersect: bool = False,
164  with_time: bool = False, evaluate_full: bool = True) -> IOVSet:
165  """
166  Retrieve defects from the database.
167 
168  Parameters:
169  `since`, `until` : IoV range to query (Default: All)
170  `channels` : A list of channels to query. Can contain a mixture of
171  defect names and ids. (Default: None means all
172  channels, including all virtual)
173  `nonpresent` : Only return IoVs which are currently "present"
174  `primary_only` : Only return primary IoVs, no virtual ones.
175  `ignore` : Set of defects which won't be treated as bad.
176  `with_primary_dependencies` : When querying virtual flags, also get
177  primary flags which went into the calculation.
178  `intersect` : Intersect the result with the query range so that no
179  iov spans outside the query range
180  `with_time` : Also retrieves the time the defect was inserted
181  ~2x slower queries, doesn't work for virtual defects
182  `evaluate_full` : If specified, also compute the `comment` and
183  `recoverable` fields of virtual defects.
184  Causes a ~0.6x slowdown
185  """
186  if ignore is not None and not isinstance(ignore, set):
187  raise RuntimeError("ignore parameter should be set type")
188 
189  desired_channels = None
190  # Figure out the IDs of channels to query and their virtuality
191  if channels is not None:
192  query_channels = set(self.defect_names_as_ids(channels))
193  virtual_channels = query_channels - self.defect_ids
194  primary_channels = query_channels & self.defect_ids
195  else:
196  # Empty channels list means query all channels
197  # (including all virtual)
198  if primary_only:
199  virtual_channels = None
200  else:
201  virtual_channels = self.virtual_defect_ids
202  primary_channels = set(self.defect_ids)
203  query_channels = None # (all)
204 
205  primary_output_names = [self.defect_id_map[pid] for pid in primary_channels]
206  virtual_output_names = [] # (optionally populated below)
207 
208  # Resolve virtual channels to query here, and the primary dependents.
209  if virtual_channels:
210  assert not primary_only, "Requested virtual channels with primary_only=True"
211  assert not with_time, "with_time flag only works for primary defects"
212  virtual_output_names = [self.virtual_defect_id_map[vid]
213  for vid in virtual_channels]
214 
215  ordered_logics = self._resolve_evaluation_order(virtual_output_names)
216 
217  if channels is not None:
218  # Since not all channels are being queried, it is necessary to
219  # add the desired primary channels to the query
220  primary_needed = self.resolve_primary_defects(ordered_logics)
221  primary_channels |= set(self.defect_names_as_ids(primary_needed))
222  query_channels = primary_channels
223 
224  if with_primary_dependencies:
225  primary_output_names.extend(sorted(primary_needed))
226 
227  for logic in ordered_logics:
228  logic.set_evaluation(evaluate_full)
229  else:
230  ordered_logics = []
231 
232  # Figure out if the set of channels will produce too many ranges for COOL
233  if query_channels is not None:
234  query_channels = sorted(query_channels)
235  query_ranges = list_to_channelselection(query_channels, None, True)
236 
237  if len(query_ranges) >= 50:
238  # We're querying too many ranges. Query everything, filter later.
239  desired_channels = set(primary_output_names + virtual_output_names)
240  query_channels = None # (everything)
241 
242  # Retrieve primary IoVs
243  primary_iovs = fetch_iovs(self.defects_folder, since, until,
244  query_channels, self.defects_tag,
245  named_channels=True, unicode_strings=True,
246  with_time=with_time)
247 
248  # Calculate virtual defects (if necessary)
249  if primary_only or not virtual_channels:
250  result = primary_iovs
251  else:
252  if not primary_iovs:
253  return IOVSet()
254  args = (primary_iovs, ordered_logics,
255  virtual_output_names, primary_output_names,
256  since, until, ignore)
257  result = calculate_virtual_defects(*args)
258 
259  # Filter out results which have their present bit removed
260  # (unless otherwise specified)
261  if not nonpresent:
262  result = IOVSet(iov for iov in result if iov.present)
263 
264  # Filter out channels which weren't queried by the user
265  # (to get around 50 channelselection COOL limit)
266  if desired_channels:
267  result = IOVSet(iov for iov in result
268  if iov.channel in desired_channels)
269 
270  if intersect:
271  result = result.intersect_range((since, until))
272 
273  return result
274 

◆ set_channel_description()

None python.ids.DefectsDBIDsNamesMixin.set_channel_description (   self,
Union[str, int]  channel,
str  description 
)
inherited
Set a defect description

Definition at line 274 of file ids.py.

274  def set_channel_description(self, channel: Union[str, int], description: str) -> None:
275  """
276  Set a defect description
277  """
278  chan_id = self.defect_chan_as_id(channel)
279  if self.defect_is_virtual(chan_id):
280  folder = self.defect_logic_folder
281  else:
282  folder = self.defects_folder
283  folder.setChannelDescription(chan_id, description.encode('utf-8'))
284 

◆ storage_buffer()

def python.db.DefectsDB.storage_buffer (   self)
Gives a new context manager for use with the with statement, e.g.:
    with ddb.storage_buffer:
for d in many_defects:
    ddb.insert(...defect...)

Definition at line 276 of file DQDefects/python/db.py.

276  def storage_buffer(self):
277  """
278  Gives a new context manager for use with the with statement, e.g.:
279  with ddb.storage_buffer:
280  for d in many_defects:
281  ddb.insert(...defect...)
282  """
283  assert not self._bad_state, "Please see comment in DefectsDB constructor"
284 
285  @contextmanager
286  def thunk():
287  log.debug("setupStorageBuffer()")
288  self.defects_folder.setupStorageBuffer()
289  try:
290  yield
291  except Exception:
292  log.warning("Exception raised during DefectsDB.storage_buffer. "
293  "Not flushing storage buffer - but COOL has no way "
294  "to empty it. ")
295  self._bad_state = True
296  raise
297  else:
298  log.debug("flushStorageBuffer()")
299  self.defects_folder.flushStorageBuffer()
300  return thunk()
301 

◆ tag()

tagtype python.tags.DefectsDBTagsMixin.tag (   self)
inherited
Readonly property stating the tag that the database was instantiated on

Definition at line 147 of file tags.py.

147  def tag(self) -> tagtype:
148  """
149  Readonly property stating the tag that the database was instantiated on
150  """
151  return self._tag
152 

◆ tags()

List[str] python.tags.DefectsDBTagsMixin.tags (   self)
inherited
The list of tags which are on the database

Definition at line 154 of file tags.py.

154  def tags(self) -> List[str]:
155  """
156  The list of tags which are on the database
157  """
158  return [str(t) for t in self.parent_folderset.listTags()]
159 

◆ update_virtual_defect()

None python.virtual_mixin.DefectsDBVirtualDefectsMixin.update_virtual_defect (   self,
str  defect_name,
str  clauses,
Optional[str]   comment = None 
)
inherited

Definition at line 56 of file virtual_mixin.py.

56  def update_virtual_defect(self, defect_name: str, clauses: str, comment: Optional[str] = None) -> None:
57  # HEAD protection is here, to allow other functions to
58  # change other tags in a known manner with _update_virtual_defect
59  assert self.logics_tag == "HEAD", NONHEAD_MODIFICATION_MSG
60  assert not self._read_only, "Insertion on read-only database"
61  self._update_virtual_defect(defect_name, clauses, comment)
62 

◆ validate_clauses()

None python.virtual_mixin.DefectsDBVirtualDefectsMixin.validate_clauses (   self,
str  clauses 
)
inherited

Definition at line 49 of file virtual_mixin.py.

49  def validate_clauses(self, clauses: str) -> None:
50  all_defects = self.defect_names | self.virtual_defect_names
51  for clause in clauses.split():
52  if clause[0] in ('!', '-'):
53  clause = clause[1:]
54  assert clause in all_defects, (clause + " is not a known defect")
55 

◆ virtual_defect_id_map()

MutableMapping[Union[str,int], Union[str,int]] python.ids.DefectsDBIDsNamesMixin.virtual_defect_id_map (   self)
inherited
Returns a dict() mapping virtual defect names to IDs and vice-versa.

Definition at line 194 of file ids.py.

194  def virtual_defect_id_map(self) -> MutableMapping[Union[str,int], Union[str,int]]:
195  """
196  Returns a dict() mapping virtual defect names to IDs and vice-versa.
197  """
198  if not self._virtual_initialized:
199  self._populate_virtual_defect_ids()
200  self._virtual_initialized = True
201  return self._virtual_defect_id_map
202 

◆ virtual_defect_ids()

Set[int] python.ids.DefectsDBIDsNamesMixin.virtual_defect_ids (   self)
inherited
Returns the set of existing virtual defect IDs

Definition at line 174 of file ids.py.

174  def virtual_defect_ids(self) -> Set[int]:
175  """
176  Returns the set of existing virtual defect IDs
177  """
178  if not self._virtual_initialized:
179  self._populate_virtual_defect_ids()
180  self._virtual_initialized = True
181  return self._virtual_defect_ids
182 

◆ virtual_defect_logics()

Mapping[str, DefectLogic] python.virtual_mixin.DefectsDBVirtualDefectsMixin.virtual_defect_logics (   self)
inherited
Returns all virtual defects in the form {"defect_name" : DefectLogic()}
for the tag DefectDB was constructed on.

Definition at line 221 of file virtual_mixin.py.

221  def virtual_defect_logics(self) -> Mapping[str, DefectLogic]:
222  """
223  Returns all virtual defects in the form {"defect_name" : DefectLogic()}
224  for the tag DefectDB was constructed on.
225  """
226  if self._virtual_defect_logics is not None:
227  return self._virtual_defect_logics
228 
229  self._virtual_defect_logics = self._get_virtual_defect_logics(self.logics_tag)
230 
231  return self._virtual_defect_logics
232 

◆ virtual_defect_names()

Set[str] python.ids.DefectsDBIDsNamesMixin.virtual_defect_names (   self)
inherited
Returns the set of existing virtual defect names

Definition at line 184 of file ids.py.

184  def virtual_defect_names(self) -> Set[str]:
185  """
186  Returns the set of existing virtual defect names
187  """
188  if not self._virtual_initialized:
189  self._populate_virtual_defect_ids()
190  self._virtual_initialized = True
191  return self._virtual_defect_names
192 

Member Data Documentation

◆ _bad_state

python.db.DefectsDB._bad_state
private

Definition at line 103 of file DQDefects/python/db.py.

◆ _connections

python.folders.DefectsDBFoldersMixin._connections
privateinherited

Definition at line 26 of file folders.py.

◆ _create

python.db.DefectsDB._create
private

Definition at line 84 of file DQDefects/python/db.py.

◆ _defect_id_map

python.virtual_mixin.DefectsDBVirtualDefectsMixin._defect_id_map
privateinherited

Definition at line 109 of file virtual_mixin.py.

◆ _defect_ids

python.ids.DefectsDBIDsNamesMixin._defect_ids
privateinherited

Definition at line 97 of file ids.py.

◆ _defect_logic_folder

python.folders.DefectsDBFoldersMixin._defect_logic_folder
privateinherited

Definition at line 24 of file folders.py.

◆ _defect_logic_payload

python.folders.DefectsDBFoldersMixin._defect_logic_payload
privateinherited

Definition at line 113 of file folders.py.

◆ _defect_names

python.virtual_mixin.DefectsDBVirtualDefectsMixin._defect_names
privateinherited

Definition at line 108 of file virtual_mixin.py.

◆ _defect_payload

python.folders.DefectsDBFoldersMixin._defect_payload
privateinherited

Definition at line 80 of file folders.py.

◆ _defects_folder

python.folders.DefectsDBFoldersMixin._defects_folder
privateinherited

Definition at line 23 of file folders.py.

◆ _initialized

python.virtual_mixin.DefectsDBVirtualDefectsMixin._initialized
privateinherited

Definition at line 110 of file virtual_mixin.py.

◆ _parent_folderset

python.folders.DefectsDBFoldersMixin._parent_folderset
privateinherited

Definition at line 25 of file folders.py.

◆ _read_only

python.db.DefectsDB._read_only
private

Definition at line 83 of file DQDefects/python/db.py.

◆ _tag

python.db.DefectsDB._tag
private

Definition at line 86 of file DQDefects/python/db.py.

◆ _virtual_defect_id_map

python.virtual_mixin.DefectsDBVirtualDefectsMixin._virtual_defect_id_map
privateinherited

Definition at line 103 of file virtual_mixin.py.

◆ _virtual_defect_ids

python.ids.DefectsDBIDsNamesMixin._virtual_defect_ids
privateinherited

Definition at line 110 of file ids.py.

◆ _virtual_defect_logics

python.virtual_mixin.DefectsDBVirtualDefectsMixin._virtual_defect_logics
privateinherited

Definition at line 46 of file virtual_mixin.py.

◆ _virtual_defect_map

python.ids.DefectsDBIDsNamesMixin._virtual_defect_map
privateinherited

Definition at line 119 of file ids.py.

◆ _virtual_defect_names

python.virtual_mixin.DefectsDBVirtualDefectsMixin._virtual_defect_names
privateinherited

Definition at line 102 of file virtual_mixin.py.

◆ _virtual_initialized

python.virtual_mixin.DefectsDBVirtualDefectsMixin._virtual_initialized
privateinherited

Definition at line 105 of file virtual_mixin.py.

◆ connection_string

python.db.DefectsDB.connection_string

Definition at line 82 of file DQDefects/python/db.py.

◆ logics_tag [1/2]

python.virtual_mixin.DefectsDBVirtualDefectsMixin.logics_tag
inherited

Definition at line 59 of file virtual_mixin.py.

◆ logics_tag [2/2]

python.tags.DefectsDBTagsMixin.logics_tag
inherited

Definition at line 167 of file tags.py.


The documentation for this class was generated from the following file:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
max
#define max(a, b)
Definition: cfImp.cxx:41
vtune_athena.format
format
Definition: vtune_athena.py:14
python.virtual_calculator.calculate_virtual_defects
IOVSet calculate_virtual_defects(IOVSet primary_iovs, Iterable[DefectLogic] evaluation_order, Iterable[str] virtual_output_channels, Iterable[str] primary_output_channels, Optional[Union[int, Tuple[int, int], RunLumi]] since, Optional[Union[int, Tuple[int, int], RunLumi]] until, Optional[Container[str]] ignore)
Definition: virtual_calculator.py:66
python.db.fetch_iovs
def fetch_iovs(folder_name, since=None, until=None, channels=None, tag="", what="all", max_records=-1, with_channel=True, loud=False, database=None, convert_time=False, named_channels=False, selection=None, runs=None, with_time=False, unicode_strings=False)
Definition: DQUtils/python/db.py:67
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.channel_mapping.get_channel_ids_names
def get_channel_ids_names(folder)
Definition: channel_mapping.py:102
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
tags
std::vector< std::string > tags
Definition: hcg.cxx:102
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
python.virtual_mixin._resolve_dependencies
def _resolve_dependencies(node, resolved=None, unresolved=None)
Definition: virtual_mixin.py:17
python.oracle.get_authentication
def get_authentication(connection="oracle://ATLAS_COOLPROD/ATLAS_COOLONL_GLOBAL")
Definition: oracle.py:38
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.channel_mapping.list_to_channelselection
def list_to_channelselection(list_, convert_channel=convert_channel, as_list=False)
Definition: channel_mapping.py:42
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.AthDsoLogger.__del__
def __del__(self)
Definition: AthDsoLogger.py:82
python.ids.choose_new_defect_id
int choose_new_defect_id(Mapping[Union[str, int], Union[str, int]] existing_map, str defect_name, bool virtual=False)
Definition: ids.py:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
pickleTool.object
object
Definition: pickleTool.py:30
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
python.PerfMonSerializer.encode
def encode(data, use_base64=True)
Definition: PerfMonSerializer.py:375
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.tags.tagtype
tagtype
Definition: tags.py:18