CMS 3D CMS Logo

conddb2hdf5.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 import argparse
3 import sys
4 import logging
5 import sqlalchemy
6 import copy
7 import h5py
8 import numpy as np
9 import multiprocessing as mp
10 from collections import OrderedDict
11 
12 from CondCore.CondHDF5ESSource.hdf5Writer import writeH5File
13 import CondCore.Utilities.conddblib as conddb
14 
15 #Global tags hold a list of Tags
16 # Tags give the
17 # record name,
18 # list of data products
19 # list of IOVs
20 # list of payloads per IOV
21 # Payloads give
22 # a payload name and
23 # the serialized data for a data product
24 # the type of data for the data product
25 #
26 
27 
28 
29 #from conddb
30 def _inserted_before(_IOV,timestamp):
31  '''To be used inside filter().
32  '''
33 
34  if timestamp is None:
35  # XXX: Returning None does not get optimized (skipped) by SQLAlchemy,
36  # and returning True does not work in Oracle (generates "and 1"
37  # which breaks Oracle but not SQLite). For the moment just use
38  # this dummy condition.
39  return sqlalchemy.literal(True) == sqlalchemy.literal(True)
40 
41  return _IOV.insertion_time <= _parse_timestamp(timestamp)
42 
43 def _parse_timestamp(timestamp):
44  try:
45  return datetime.datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S.%f')
46  except ValueError:
47  pass
48 
49  try:
50  return datetime.datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
51  except ValueError:
52  pass
53 
54  try:
55  return datetime.datetime.strptime(timestamp, '%Y-%m-%d')
56  except ValueError:
57  pass
58 
59  raise Exception("Could not parse timestamp '%s'" % timestamp)
60 
61 def _exists(session, primary_key, value):
62  ret = None
63  try:
64  ret = session.query(primary_key).\
65  filter(primary_key == value).\
66  count() != 0
67  except sqlalchemy.exc.OperationalError:
68  pass
69 
70  return ret
71 
72 def _connect(db, init, read_only, args, as_admin=False):
73 
74  logging.debug('Preparing connection to %s ...', db)
75 
76  url = conddb.make_url( db, read_only)
77  pretty_url = url
78  if url.drivername == 'oracle+frontier':
79  ws = url.host.rsplit('%2F')
80  if ws is not None:
81  pretty_url = 'frontier://%s/%s' %(ws[-1],url.database)
82  connTo = '%s [%s]' %(db,pretty_url)
83  logging.info('Connecting to %s', connTo)
84  logging.debug('DB url: %s',url)
85  verbose= 0
86  if args.verbose is not None:
87  verbose = args.verbose - 1
88  connection = conddb.connect(url, args.authPath, verbose, as_admin)
89 
90 
91  if not read_only:
92  if connection.is_read_only:
93  raise Exception('Impossible to edit a read-only database.')
94 
95  if connection.is_official:
96  if args.force:
97  if not args.yes:
98  logging.warning('You are going to edit an official database. If you are not one of the Offline DB experts but have access to the password for other reasons, please stop now.')
99  else:
100  raise Exception('Editing official databases is forbidden. Use the official DropBox to upload conditions. If you need a special intervention on the database, see the contact help: %s' % conddb.contact_help)
101  # for sqlite we trigger the implicit schema creation
102  if url.drivername == 'sqlite':
103  if init:
104  connection.init()
105  if not connection._is_valid:
106  raise Exception('No valid schema found in the database.')
107 
108  return connection
109 
110 
111 def connect(args, init=False, read_only=True, as_admin=False):
112  args.force = args.force if 'force' in dir(args) else False
113 
114  if 'destdb' in args:
115  if args.destdb is None:
116  args.destdb = args.db
117  if args.db == args.destdb:
118  conn1 = _connect(args.destdb, init, read_only, args)
119  return conn1, conn1
120  conn1 = _connect( args.db, init, True, args)
121  conn2url = conddb.make_url(args.destdb, False)
122  if conn2url.drivername == 'sqlite' and not os.path.exists(args.destdb):
123  init = True
124  conn2 = _connect(args.destdb, init, False, args)
125  return conn1, conn2
126 
127  return _connect( args.db, init, read_only, args, as_admin)
128 
129 
130 def _high(n):
131  return int(n) >> 32
132 
133 def _low(n):
134  return int(n) & 0xffffffff
135 
136 #end from conddb
137 
138 #based on conddb._dump_payload
139 def get_payloads_objtype_data(session, payloads):
140 
141  Payload = session.get_dbtype(conddb.Payload)
142  table = session.query(Payload.hash, Payload.object_type, Payload.data).\
143  filter(Payload.hash.in_(payloads)).order_by(Payload.hash).all()
144  return table
145 
147  connection = connect(args)
148  session = connection.session()
149  queue.put(get_payloads_objtype_data(session, payloads))
150 #local
151 
153  def __init__(self, high, low):
154  self.high = high
155  self.low = low
156 
158  def __init__(self, args, payloads):
159  self._args = args
160  self._payloadHashs = payloads
161  self._payloadCache = {}
163  self._cacheChunking = 1
165  self._nextIndex = 0
166  def __iter__(self):
167  return self
168  def __next__(self):
169  if self._nextIndex >= len(self._payloadHashs):
170  raise StopIteration()
171  payloadHash = self._payloadHashs[self._nextIndex]
172  if not self._payloadCache:
174  queue = mp.Queue()
175  p=mp.Process(target=external_process_get_payloads_objtype_data, args=(queue, self._args, self._payloadHashs[self._payloadHashsIndex:self._payloadHashsIndex+self._cacheChunking]))
176  p.start()
177  table = queue.get()
178  p.join()
179  #table = get_payloads_objtype_data(session, payloadHashs[payloadHashsIndex:payloadHashsIndex+cacheChunking])
180  #print(table)
182  for r in table:
183  self._payloadCache[r[0]] = (r[1],r[2])
184  objtype,data = self._payloadCache[payloadHash]
185  if len(data) < 1000000:
186  self._safeChunkingSize = 10
187  del self._payloadCache[payloadHash]
188  self._nextIndex +=1
189  return DBPayload(payloadHash, canonicalProductName(objtype.encode("ascii")), data)
190 
191 
193  def __init__(self,hash_, type_, data):
194  self._hash = hash_
195  self._type = type_
196  self._data = data
197  def name(self):
198  return self._hash
199  def actualType(self):
200  return self._type
201  def data(self):
202  return self._data
203 
205  def __init__(self, ctype, label, payloadHashes, args):
206  self._type = ctype
207  self._label = label
208  self._payloadHashs = payloadHashes
209  self._args = args
210 
211  def name(self):
212  return self._type +"@"+self._label
213  def objtype(self):
214  return self._type
215  def payloads(self):
216  return DBPayloadIterator(self._args, self._payloadHashs)
217 
218 class DBTag(object):
219  def __init__(self, session, args, record, productNtags):
220  self._session = session
221  self._args = args
222  self._snapshot = args.snapshot
223  self._record = record
224  self._productLabels = [x[0] for x in productNtags]
225  self._dbtags = [x[1] for x in productNtags]
226  self._type = None
227  self._iovsNPayloads = None
228  self._time_type = None
229  def record(self):
230  return self._record
231  def name(self):
232  if len(self._dbtags) == 1:
233  return self._dbtags[0]
234  return self._dbtags[0]+"@joined"
235  def __type(self):
236  if self._type is None:
237  self._type = recordToType(self._record)
238  return self._type
239  def time_type(self):
240  if self._time_type is None:
241  self.iovsNPayloadNames()
242  return timeTypeName(self._time_type)
243  def originalTagNames(self):
244  return self._dbtags
245  def iovsNPayloadNames(self):
246  if self._iovsNPayloads is None:
247  finalIOV = []
248  for tag in self._dbtags:
249  time_type, iovAndPayload = tagInfo(self._session, tag, self._snapshot)
250  self._time_type = time_type
251  if not finalIOV:
252  finalIOV = [ [i[0],[i[1]]] for i in iovAndPayload]
253  else:
254  finalIOV = mergeIOVs(finalIOV, iovAndPayload)
255 
256  firstValues, lastValues = sinceToIOV( (x[0] for x in finalIOV), time_type)
257 
258  self._iovsNPayloads = list(zip((IOVSyncValue(x[0],x[1]) for x in firstValues), (IOVSyncValue(x[0], x[1]) for x in lastValues), (x[1] for x in finalIOV)))
259  self._session.flush()
260  self._session.commit()
261  return self._iovsNPayloads
262 
263  def dataProducts(self):
264  t = self.__type()
265  iovs = self.iovsNPayloadNames()
266  payloadForProducts = []
267  for p in self._productLabels:
268  payloadForProducts.append(OrderedDict())
269  for first,last,payloads in iovs:
270  for i,p in enumerate(payloads):
271  if p is not None:
272  payloadForProducts[i][p]=None
273  return [DBDataProduct(t,v,list(payloadForProducts[i]), self._args) for i,v in enumerate(self._productLabels)]
274 
276  def __init__(self, args, session, name):
277  self._session = session
278  self._args = args
279  self._snapshot = args.snapshot
280  self._name = name
281  self._tags = []
282  gt = globalTagInfo(session,name)
283  lastRcd = None
284  tags = []
285  for rcd, label, tag in gt:
286  if rcd != lastRcd:
287  if lastRcd is not None:
288  self._tags.append(DBTag(session,args, lastRcd,tags))
289  lastRcd = rcd
290  tags = []
291  tags.append((label,tag))
292  if lastRcd is not None:
293  self._tags.append(DBTag(session,args, lastRcd, tags))
294  def tags(self):
295  return self._tags
296 
297 def timeTypeName(time_type):
298  if time_type == conddb.TimeType.Time.value:
299  return 'time'
300  if time_type == conddb.TimeType.Run.value or time_type == conddb.TimeType.Lumi.value:
301  return 'run_lumi'
302  raise RuntimeError("unknown since time %s:"% str(time_type))
303 
304 
305 
306 def parseSince(time_type, since):
307  if time_type == conddb.TimeType.Time.value:
308  return (_high(since), _low(since))
309  if time_type == conddb.TimeType.Run.value:
310  return (_high(since), 0)
311  if time_type == conddb.TimeType.Lumi.value:
312  return (_high(since), _low(since))
313 
314 def previousSyncValue(syncValue):
315  if syncValue[1] == 0:
316  return (syncValue[0]-1, 0xffffffff)
317  return (syncValue[0], syncValue[1]-1)
318 
319 def sinceToIOV(sinceList, time_type):
320  firstValues = []
321  lastValues = []
322  for since in sinceList:
323  syncValue = parseSince(time_type, since)
324  firstValues.append(syncValue)
325  if len(firstValues) != 1:
326  lastValues.append(previousSyncValue(syncValue))
327  lastValues.append((0xFFFFFFFF,0xFFFFFFFF))
328  return [firstValues,lastValues]
329 
330 def globalTagInfo(session,name):
331  GlobalTag = session.get_dbtype(conddb.GlobalTag)
332  GlobalTagMap = session.get_dbtype(conddb.GlobalTagMap)
333  try:
334  is_global_tag = _exists(session, GlobalTag.name, name)
335  if is_global_tag:
336  return session.query(GlobalTagMap.record, GlobalTagMap.label, GlobalTagMap.tag_name).\
337  filter(GlobalTagMap.global_tag_name == name).\
338  order_by(GlobalTagMap.record, GlobalTagMap.label).\
339  all()
340  except sqlalchemy.exc.OperationalError:
341  sys.stderr.write("No table for GlobalTags found in DB.\n\n")
342  return None
343 
344 def tagInfo(session, name, snapshot):
345  Tag = session.get_dbtype(conddb.Tag)
346  IOV = session.get_dbtype(conddb.IOV)
347  is_tag = _exists(session, Tag.name, name)
348  if is_tag:
349  time_type = session.query(Tag.time_type).\
350  filter(Tag.name == name).\
351  scalar()
352 
353  rawTagInfo = session.query(IOV.since, IOV.insertion_time, IOV.payload_hash).\
354  filter(
355  IOV.tag_name == name,
356  _inserted_before(IOV,snapshot),
357  ).\
358  order_by(IOV.since.desc(), IOV.insertion_time.desc()).\
359  from_self().\
360  order_by(IOV.since, IOV.insertion_time).\
361  all()
362  filteredTagInfo = []
363  lastSince = -1
364  for since,insertion,payload in rawTagInfo:
365  if lastSince == since:
366  continue
367  lastSince = since
368  if time_type == conddb.TimeType.Run.value:
369  #need to make Run and RunLumi directly comparable since some records
370  # use a mix of the two for their IOVs
371  since = int(since) << 32
372  filteredTagInfo.append((since,payload))
373 
374  if time_type == conddb.TimeType.Run.value:
375  time_type = conddb.TimeType.Lumi.value
376 
377  return time_type, filteredTagInfo
378 # [sinceLabel, 'Insertion Time', 'Payload', 'Object Type'],
379 # filters = [_since_filter(time_type), None, None, None],
380 # )
381 
382 def _checkMerge(previousIOV, newIOV, debugCopy, nExistingDataProducts):
383  #sanity check
384  #check proper number of entries
385  previousSince = -1
386  for i,e in enumerate(previousIOV):
387  if len(e[1]) != nExistingDataProducts+1:
388  raise RuntimeError("entry %i has wrong number of elements %i instead of %i"%(i,len(e[1]),nExistingDataProducts+1))
389  if previousSince >= e[0]:
390  #print(previousIOV,newIOV)
391  raise RuntimeError("IOV not in order for index %i"%i)
392  previousSince = e[0]
393 
394  previousIndex = 0
395  debugIndex =0
396  while debugIndex < len(debugCopy) and previousIndex < len(previousIOV):
397  previousSince = previousIOV[previousIndex][0]
398  debugSince = debugCopy[debugIndex][0]
399  #print("debugSince: %i, prevSince: %i"%(debugSince,previousSince))
400  #print(debugCopy)
401  #print(previousIOV)
402  if debugSince != previousSince:
403  previousIndex +=1
404  continue
405  if debugCopy[debugIndex][1] != previousIOV[previousIndex][1][:nExistingDataProducts]:
406  raise RuntimeError("packaged were not properly copied for index %i original:%s new:%s"%(debugIndex,",".join(debugCopy[debugIndex][1]),",".join(previousIOV[previousIndex][1][:nExistingDataProducts])))
407  debugIndex +=1
408  previousIndex +=1
409  if debugIndex != len(debugCopy):
410  raise RuntimeError("failed to copy forward index %i"%debugIndex)
411  newIndex = 0
412  previousIndex = 0
413  while newIndex < len(newIOV) and previousIndex < len(previousIOV):
414  previousSince = previousIOV[previousIndex][0]
415  newSince = newIOV[newIndex][0]
416  if newSince != previousSince:
417  previousIndex +=1
418  continue
419  if previousIOV[previousIndex][1][-1] != newIOV[newIndex][1]:
420  raise RuntimeError("failed to append package at index %i"%newIndex)
421  previousIndex +=1
422  newIndex +=1
423  if newIndex != len(newIOV):
424  raise RuntimeError("failed to merge IOV entry %i"%newIndex)
425 
426 
427 def mergeIOVs(previousIOV, newIOV):
428  debugCopy = copy.deepcopy(previousIOV)
429  previousSize = len(previousIOV)
430  newSize = len(newIOV)
431  previousIndex = 0
432  newIndex =0
433  nExistingDataProducts = len(previousIOV[0][1])
434  while newIndex < newSize and previousIndex < previousSize:
435 
436  previousSince = previousIOV[previousIndex][0]
437  newSince = newIOV[newIndex][0]
438  if previousSince == newSince:
439  previousIOV[previousIndex][1].append(newIOV[newIndex][1])
440  newIndex +=1
441  previousIndex +=1
442  continue
443  elif newSince < previousSince:
444  if previousIndex == 0:
445  payloads = [None]*nExistingDataProducts
446  payloads.append(newIOV[newIndex][1])
447  previousIOV.insert(0,[newSince,payloads])
448  else:
449  payloads = previousIOV[previousIndex-1][1][:nExistingDataProducts]
450  payloads.append(newIOV[newIndex][1])
451  previousIOV.insert(previousIndex,[newSince,payloads])
452  newIndex +=1
453  previousIndex +=1
454  previousSize +=1
455  elif newSince > previousSince:
456  if newIndex == 0:
457  previousIOV[previousIndex][1].append(None)
458  else:
459  if len(previousIOV[previousIndex][1]) == nExistingDataProducts:
460  previousIOV[previousIndex][1].append(newIOV[newIndex-1][1])
461  previousIndex +=1
462  if newIndex != newSize:
463  #print("NEED TO EXTEND")
464  #need to append to end
465  previousPayloads = previousIOV[-1][1]
466  while newIndex != newSize:
467  newPayloads = previousPayloads[:]
468  newPayloads[nExistingDataProducts] = newIOV[newIndex][1]
469  previousIOV.append([newIOV[newIndex][0], newPayloads])
470  newIndex +=1
471  if previousIndex != previousSize:
472  #need to add new item to all remaining entries
473  while previousIndex < previousSize:
474  previousIOV[previousIndex][1].append(newIOV[-1][1])
475  previousIndex +=1
476  _checkMerge(previousIOV, newIOV, debugCopy, nExistingDataProducts)
477  return previousIOV
478 
479 def writeTagImpl(tagsGroup, name, recName, time_type, IOV_payloads, payloadToRefs, originalTagNames):
480  tagGroup = tagsGroup.create_group(name)
481  tagGroup.attrs["time_type"] = time_type.encode("ascii") #timeTypeName(time_type).encode("ascii")
482  tagGroup.attrs["db_tags"] = [x.encode("ascii") for x in originalTagNames]
483  tagGroup.attrs["record"] = recName.encode("ascii")
484  firstValues = [x[0] for x in IOV_payloads]
485  lastValues = [x[1] for x in IOV_payloads]
486  syncValueType = np.dtype([("high", np.uint32),("low", np.uint32)])
487  first_np = np.empty(shape=(len(IOV_payloads),), dtype=syncValueType)
488  first_np['high'] = [ x.high for x in firstValues]
489  first_np['low'] = [ x.low for x in firstValues]
490  last_np = np.empty(shape=(len(lastValues),), dtype=syncValueType)
491  last_np['high'] = [ x.high for x in lastValues]
492  last_np['low'] = [ x.low for x in lastValues]
493  #tagGroup.create_dataset("first",data=np.array(firstValues), dtype=syncValueType)
494  #tagGroup.create_dataset("last", data=np.array(lastValues),dtype=syncValueType)
495  payloads = [ [ payloadToRefs[y] for y in x[2]] for x in IOV_payloads]
496  compressor = None
497  if len(first_np) > 100:
498  compressor = 'gzip'
499  tagGroup.create_dataset("first",data=first_np, compression = compressor)
500  tagGroup.create_dataset("last",data=last_np, compression = compressor)
501  tagGroup.create_dataset("payload", data=payloads, dtype=h5py.ref_dtype, compression = compressor)
502  return tagGroup.ref
503 
504 
505 def writeTag(tagsGroup, time_type, IOV_payloads, payloadToRefs, originalTagNames, recName):
506  name = originalTagNames[0]
507  if len(originalTagNames) != 1:
508  name = name+"@joined"
509  return writeTagImpl(tagsGroup, name, recName, time_type, IOV_payloads, payloadToRefs, originalTagNames)
510 
511 
512 def recordToType(record):
513  import subprocess
514  return subprocess.run(["condRecordToDataProduct",record], capture_output = True, check=True, text=True).stdout
515 
516 __typedefs = {b"ESCondObjectContainer<ESPedestal>":"ESPedestals",
517  b"ESCondObjectContainer<float>":"ESFloatCondObjectContainer",
518  b"ESCondObjectContainer<ESChannelStatusCode>":"ESChannelStatus",
519  b"EcalCondObjectContainer<EcalPedestal>":"EcalPedestals",
520  b"EcalCondObjectContainer<EcalXtalGroupId>":"EcalWeightXtalGroups",
521  b"EcalCondObjectContainer<EcalMGPAGainRatio>":"EcalGainRatios",
522  b"EcalCondObjectContainer<float>":"EcalFloatCondObjectContainer",
523  b"EcalCondObjectContainer<EcalChannelStatusCode>":"EcalChannelStatus",
524  b"EcalCondObjectContainer<EcalMappingElement>":"EcalMappingElectronics",
525  b"EcalCondObjectContainer<EcalTPGPedestal>":"EcalTPGPedestals",
526  b"EcalCondObjectContainer<EcalTPGLinearizationConstant>":"EcalTPGLinearizationConst",
527  b"EcalCondObjectContainer<EcalTPGCrystalStatusCode>":"EcalTPGCrystalStatus",
528  b"EcalCondTowerObjectContainer<EcalChannelStatusCode>":"EcalDCSTowerStatus",
529  b"EcalCondTowerObjectContainer<EcalDAQStatusCode>":"EcalDAQTowerStatus",
530  b"EcalCondObjectContainer<EcalDQMStatusCode>":"EcalDQMChannelStatus",
531  b"EcalCondTowerObjectContainer<EcalDQMStatusCode>":"EcalDQMTowerStatus",
532  b"EcalCondObjectContainer<EcalPulseShape>":"EcalPulseShapes",
533  b"EcalCondObjectContainer<EcalPulseCovariance>":"EcalPulseCovariances",
534  b"EcalCondObjectContainer<EcalPulseSymmCovariance>":"EcalPulseSymmCovariances",
535  b"HcalItemCollById<HFPhase1PMTData>": "HFPhase1PMTParams",
536  b"l1t::CaloParams":"CaloParams",
537  b"StorableDoubleMap<AbsOOTPileupCorrection>":"OOTPileupCorrectionMapColl",
538  b"PhysicsTools::Calibration::Histogram3D<double,double,double,double>":"PhysicsTools::Calibration::HistogramD3D",
539  b"PhysicsTools::Calibration::MVAComputerContainer":"MVAComputerContainer"
540 }
541 def canonicalProductName(product):
542  return __typedefs.get(product,product)
543 
544 def main():
545  parser = argparse.ArgumentParser(description='Read from CMS Condition DB and write to HDF5 file')
546  parser.add_argument('--db', '-d', default='pro', help='Database to run the command on. Run the help subcommand for more information: conddb help')
547  parser.add_argument('name', nargs='+', help="Name of the global tag.")
548  parser.add_argument('--verbose', '-v', action='count', help='Verbosity level. -v prints debugging information of this tool, like tracebacks in case of errors. -vv prints, in addition, all SQL statements issued. -vvv prints, in addition, all results returned by queries.')
549  parser.add_argument('--authPath','-a', default=None, help='Path of the authentication .netrc file. Default: the content of the COND_AUTH_PATH environment variable, when specified.')
550  parser.add_argument('--snapshot', '-T', default=None, help="Snapshot time. If provided, the output will represent the state of the IOVs inserted into database up to the given time. The format of the string must be one of the following: '2013-01-20', '2013-01-20 10:11:12' or '2013-01-20 10:11:12.123123'.")
551  parser.add_argument('--exclude', '-e', nargs='*', help = 'list of records to exclude from the file (can not be used with --include)')
552  parser.add_argument('--include', '-i', nargs='*', help = 'lost of the only records that should be included in the file (can not be used with --exclude')
553  parser.add_argument('--output', '-o', default='test.h5cond', help='name of hdf5 output file to write')
554  parser.add_argument('--compressor', '-c', default='zlib', choices =['zlib','lzma','none'], help="compress data using 'zlib', 'lzma' or 'none'")
555  args = parser.parse_args()
556 
557  if args.exclude and args.include:
558  print("Can not use --exclude and --include at the same time")
559  exit(-1)
560 
561  connection = connect(args)
562  session = connection.session()
563 
564  excludeRecords = set()
565  if args.exclude:
566  excludeRecords = set(args.exclude)
567  includeRecords = set()
568  if args.include:
569  includeRecords = set(args.include)
570 
571  writeH5File(args.output, args.name, excludeRecords, includeRecords, lambda x: DBGlobalTag(args, session, x), args.compressor )
572 
573 if __name__ == '__main__':
574  main()
def external_process_get_payloads_objtype_data(queue, args, payloads)
Definition: conddb2hdf5.py:146
def _parse_timestamp(timestamp)
Definition: conddb2hdf5.py:43
def __init__(self, args, session, name)
Definition: conddb2hdf5.py:276
def writeH5File(fileName, globalTags, excludeRecords, includeRecords, tagReader, compressorName)
Definition: hdf5Writer.py:70
def iovsNPayloadNames(self)
Definition: conddb2hdf5.py:245
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
def __init__(self, ctype, label, payloadHashes, args)
Definition: conddb2hdf5.py:205
def __init__(self, args, payloads)
Definition: conddb2hdf5.py:158
def record(self)
Definition: conddb2hdf5.py:229
def canonicalProductName(product)
Definition: conddb2hdf5.py:541
def recordToType(record)
Definition: conddb2hdf5.py:512
def tagInfo(session, name, snapshot)
Definition: conddb2hdf5.py:344
def __init__(self, session, args, record, productNtags)
Definition: conddb2hdf5.py:219
def _inserted_before(_IOV, timestamp)
Definition: conddb2hdf5.py:30
def sinceToIOV(sinceList, time_type)
Definition: conddb2hdf5.py:319
def __type(self)
Definition: conddb2hdf5.py:235
def __init__(self, high, low)
Definition: conddb2hdf5.py:153
def globalTagInfo(session, name)
Definition: conddb2hdf5.py:330
def originalTagNames(self)
Definition: conddb2hdf5.py:243
def parseSince(time_type, since)
Definition: conddb2hdf5.py:306
def _connect(db, init, read_only, args, as_admin=False)
Definition: conddb2hdf5.py:72
def mergeIOVs(previousIOV, newIOV)
Definition: conddb2hdf5.py:427
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def _high(n)
Definition: conddb2hdf5.py:130
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def writeTag(tagsGroup, time_type, IOV_payloads, payloadToRefs, originalTagNames, recName)
Definition: conddb2hdf5.py:505
def dataProducts(self)
Definition: conddb2hdf5.py:263
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def timeTypeName(time_type)
Definition: conddb2hdf5.py:297
def time_type(self)
Definition: conddb2hdf5.py:239
Definition: main.py:1
def connect(args, init=False, read_only=True, as_admin=False)
Definition: conddb2hdf5.py:111
def _low(n)
Definition: conddb2hdf5.py:133
def previousSyncValue(syncValue)
Definition: conddb2hdf5.py:314
#define str(s)
def _checkMerge(previousIOV, newIOV, debugCopy, nExistingDataProducts)
Definition: conddb2hdf5.py:382
def writeTagImpl(tagsGroup, name, recName, time_type, IOV_payloads, payloadToRefs, originalTagNames)
Definition: conddb2hdf5.py:479
def get_payloads_objtype_data(session, payloads)
Definition: conddb2hdf5.py:139
def _exists(session, primary_key, value)
Definition: conddb2hdf5.py:61
def __init__(self, hash_, type_, data)
Definition: conddb2hdf5.py:193
def exit(msg="")