CMS 3D CMS Logo

conddb_version_mgr.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from __future__ import print_function
4 import cx_Oracle
5 import datetime
6 import calendar
7 import sys
8 import logging
9 import CondCore.Utilities.conddb_serialization_metadata as sm
10 import CondCore.Utilities.credentials as auth
11 import CondCore.Utilities.conddb_time as conddb_time
12 import os
13 
14 prod_db_service = ('cms_orcon_prod',{'w':'cms_orcon_prod/cms_cond_general_w','r':'cms_orcon_prod/cms_cond_general_r'})
15 adg_db_service = ('cms_orcon_adg',{'r':'cms_orcon_adg/cms_cond_general_r'})
16 dev_db_service = ('cms_orcoff_prep',{'w':'cms_orcoff_prep/cms_cond_general_w','r':'cms_orcoff_prep/cms_cond_general_r'})
17 schema_name = 'CMS_CONDITIONS'
18 
19 fmt_str = "[%(asctime)s] %(levelname)s: %(message)s"
20 logLevel = logging.INFO
21 logFormatter = logging.Formatter(fmt_str)
22 
23 def print_table( headers, table ):
24  ws = []
25  for h in headers:
26  ws.append(len(h))
27  for row in table:
28  ind = 0
29  for c in row:
30  c = str(c)
31  if ind<len(ws):
32  if len(c)> ws[ind]:
33  ws[ind] = len(c)
34  ind += 1
35 
36  def printf( row ):
37  line = ''
38  ind = 0
39  for w in ws:
40  fmt = '{:<%s}' %w
41  if ind<len(ws):
42  line += (fmt.format( row[ind] )+' ')
43  ind += 1
44  print(line)
45  printf( headers )
46  hsep = ''
47  for w in ws:
48  fmt = '{:-<%s}' %w
49  hsep += (fmt.format('')+' ')
50  print(hsep)
51  for row in table:
52  printf( row )
53 
55  def __init__(self, db ):
56  self.db = db
57  self.cmssw_boost_map = {}
58  self.boost_run_map = []
59 
60  def fetch_cmssw_boost_map( self ):
61  cursor = self.db.cursor()
62  cursor.execute('SELECT BOOST_VERSION, CMSSW_VERSION FROM CMSSW_BOOST_MAP');
63  rows = cursor.fetchall()
64  self.cmssw_boost_map = {}
65  for r in rows:
66  self.cmssw_boost_map[r[1]]=r[0]
67  return self.cmssw_boost_map
68 
69  def fetch_boost_run_map( self ):
70  cursor = self.db.cursor()
71  cursor.execute('SELECT RUN_NUMBER, RUN_START_TIME, BOOST_VERSION, INSERTION_TIME FROM BOOST_RUN_MAP ORDER BY RUN_NUMBER, INSERTION_TIME')
72  rows = cursor.fetchall()
73  self.boost_run_map = []
74  for r in rows:
75  self.boost_run_map.append( (r[0],r[1],r[2],str(r[3])) )
76  return self.boost_run_map
77 
78  def insert_boost_run_range( self, run, boost_version, min_ts ):
79  cursor = self.db.cursor()
80  cursor.execute('SELECT MIN(RUN_NUMBER) FROM RUN_INFO WHERE RUN_NUMBER >= :RUN',(run,))
81  res = cursor.fetchone()
82  if res is not None and res[0] is not None:
83  min_run = res[0]
84  cursor.execute('SELECT START_TIME FROM RUN_INFO WHERE RUN_NUMBER=:RUN',(min_run,))
85  min_run_time = cursor.fetchone()[0]
86  min_run_ts = calendar.timegm( min_run_time.utctimetuple() ) << 32
87  else:
88  min_run = run
89  min_run_ts = conddb_time.string_to_timestamp(min_ts)
90  now = datetime.datetime.utcnow()
91  cursor.execute('INSERT INTO BOOST_RUN_MAP ( RUN_NUMBER, RUN_START_TIME, BOOST_VERSION, INSERTION_TIME ) VALUES (:RUN, :RUN_START_T, :BOOST, :TIME)',(run,min_run_ts,boost_version,now) )
92 
93  def insert_cmssw_boost( self, cmssw_version,boost_version ):
94  cursor = self.db.cursor()
95  cursor.execute('INSERT INTO CMSSW_BOOST_MAP ( CMSSW_VERSION, BOOST_VERSION ) VALUES ( :CMSSW_VERSION, :BOOST_VERSION )',(cmssw_version,boost_version))
96 
97  def lookup_boost_in_cmssw( self, cmssw_version ):
98  cmssw_v = sm.check_cmssw_version( cmssw_version )
99  the_arch = None
100  releaseRoot = None
101  if sm.is_release_cycle( cmssw_v ):
102  cmssw_v = sm.strip_cmssw_version( cmssw_v )
103  archs = sm.get_production_arch( cmssw_v )
104  for arch in archs:
105  path = sm.get_release_root( cmssw_v, arch )
106  if os.path.exists(os.path.join(path,cmssw_v)):
107  releaseRoot = path
108  the_arch = arch
109  break
110  if releaseRoot is None:
111  for arch in archs:
112  the_arch = arch
113  releaseRoot = sm.get_release_root( cmssw_v, arch )
114  for r in sorted (os.listdir( releaseRoot )):
115  if r.startswith(cmssw_v):
116  cmssw_v = r
117  logging.debug('Boost version will be verified in release %s' %cmssw_v)
118 
119  if cmssw_v in self.cmssw_boost_map.keys():
120  return self.cmssw_boost_map[cmssw_v]
121 
122  if releaseRoot is None:
123  archs = sm.get_production_arch( cmssw_v )
124  for arch in archs:
125  path = sm.get_release_root( cmssw_v, arch )
126  if os.path.exists(os.path.join(path,cmssw_v)):
127  releaseRoot = path
128  the_arch = arch
129  break
130  logging.debug('Release path: %s' %releaseRoot)
131  boost_version = sm.get_cmssw_boost( the_arch, '%s/%s' %(releaseRoot,cmssw_v) )
132  if not boost_version is None:
133  self.cmssw_boost_map[cmssw_v] = boost_version
134  self.insert_cmssw_boost( cmssw_v,boost_version )
135  return boost_version
136 
137  def populate_for_gts( self ):
138  cursor = self.db.cursor()
139  cursor.execute('SELECT DISTINCT(RELEASE) FROM GLOBAL_TAG')
140  rows = cursor.fetchall()
141  for r in rows:
142  self.lookup_boost_in_cmssw( r[0] )
143 
145  def __init__( self ):
146  self.db = None
147  self.version_db = None
148  self.args = None
149  self.logger = logging.getLogger()
150  self.logger.setLevel(logLevel)
151  consoleHandler = logging.StreamHandler(sys.stdout)
152  consoleHandler.setFormatter(logFormatter)
153  self.logger.addHandler(consoleHandler)
154  self.iovs = None
155  self.versionIovs = None
156 
157  def connect( self ):
158  if self.args.db is None:
159  self.args.db = 'pro'
160  if self.args.db == 'dev' or self.args.db == 'oradev' :
161  db_service = dev_db_service
162  elif self.args.db == 'orapro':
163  db_service = adg_db_service
164  elif self.args.db != 'onlineorapro' or self.args.db != 'pro':
165  db_service = prod_db_service
166  else:
167  raise Exception("Database '%s' is not known." %args.db )
168  if self.args.accessType not in db_service[1].keys():
169  raise Exception('The specified database connection %s does not support the requested action.' %db_service[0])
170  service = db_service[1][self.args.accessType]
171  creds = auth.get_credentials( service, self.args.auth )
172  if creds is None:
173  raise Exception("Could not find credentials for service %s" %service)
174  (username, account, pwd) = creds
175  connStr = '%s/%s@%s' %(username,pwd,db_service[0])
176  self.db = cx_Oracle.connect(connStr)
177  logging.info('Connected to %s as user %s' %(db_service[0],username))
178  self.db.current_schema = schema_name
179 
180  def process_tag_boost_version( self, t, timetype, tagBoostVersion, minIov, timeCut, validate ):
181  if self.iovs is None:
182  self.iovs = []
183  cursor = self.db.cursor()
184  stmt = 'SELECT IOV.SINCE SINCE, IOV.INSERTION_TIME INSERTION_TIME, P.STREAMER_INFO STREAMER_INFO FROM TAG, IOV, PAYLOAD P WHERE TAG.NAME = IOV.TAG_NAME AND P.HASH = IOV.PAYLOAD_HASH AND TAG.NAME = :TAG_NAME'
185  params = (t,)
186  if timeCut and tagBoostVersion is not None and not validate:
187  whereClauseOnSince = ' AND IOV.INSERTION_TIME>:TIME_CUT'
188  stmt = stmt + whereClauseOnSince
189  params = params + (timeCut,)
190  stmt = stmt + ' ORDER BY SINCE'
191  logging.debug('Executing: "%s"' %stmt)
192  cursor.execute(stmt,params)
193  for r in cursor:
194  streamer_info = str(r[2].read())
195  self.iovs.append((r[0],r[1],streamer_info))
196  niovs = 0
197  self.versionIovs = []
198  lastBoost = None
199  update = False
200  if tagBoostVersion is not None:
201  update = True
202  for iov in self.iovs:
203  if validate and timeCut is not None and timeCut < iov[1]:
204  continue
205  niovs += 1
206  iovBoostVersion, tagBoostVersion = sm.update_tag_boost_version( tagBoostVersion, minIov, iov[2], iov[0], timetype, self.version_db.boost_run_map )
207  if minIov is None or iov[0]<minIov:
208  minIov = iov[0]
209  logging.debug('iov: %s - inserted on %s - streamer: %s' %(iov[0],iov[1],iov[2]))
210  logging.debug('current tag boost version: %s minIov: %s' %(tagBoostVersion,minIov))
211  if lastBoost is None or lastBoost!=iovBoostVersion:
212  self.versionIovs.append((iov[0],iovBoostVersion))
213  lastBoost = iovBoostVersion
214 
215  if tagBoostVersion is None:
216  if niovs == 0:
217  logging.warning( 'No iovs found. boost version cannot be determined.')
218  return None, None
219  else:
220  logging.error('Could not determine the tag boost version.' )
221  return None, None
222  else:
223  if niovs == 0:
224  logging.info('Tag boost version has not changed.')
225  else:
226  msg = 'Found tag boost version %s ( min iov: %s ) combining payloads from %s iovs' %(tagBoostVersion,minIov,niovs)
227  if timeCut is not None:
228  if update:
229  msg += ' (iov insertion time>%s)' %str(timeCut)
230  else:
231  msg += ' (iov insertion time<%s)' %str(timeCut)
232  logging.info( msg )
233  return tagBoostVersion, minIov
234 
235  def validate_boost_version( self, t, timetype, tagBoostVersion ):
236  cursor = self.db.cursor()
237  cursor.execute('SELECT GT.NAME, GT.RELEASE, GT.SNAPSHOT_TIME FROM GLOBAL_TAG GT, GLOBAL_TAG_MAP GTM WHERE GT.NAME = GTM.GLOBAL_TAG_NAME AND GTM.TAG_NAME = :TAG_NAME',(t,))
238  rows = cursor.fetchall()
239  invalid_gts = []
240  ngt = 0
241  gts = []
242  for r in rows:
243  gts.append((r[0],r[1],r[2]))
244  if len(gts)>0:
245  logging.info('validating %s gts.' %len(gts))
246  boost_snapshot_map = {}
247  for gt in gts:
248  ngt += 1
249  logging.debug('Validating for GT %s (release %s)' %(gt[0],gt[1]))
250  gtCMSSWVersion = sm.check_cmssw_version( gt[1] )
251  gtBoostVersion = self.version_db.lookup_boost_in_cmssw( gtCMSSWVersion )
252  if sm.cmp_boost_version( gtBoostVersion, tagBoostVersion )<0:
253  logging.warning( 'The boost version computed from all the iovs in the tag (%s) is incompatible with the gt [%s] %s (consuming ver: %s, snapshot: %s)' %(tagBoostVersion,ngt,gt[0],gtBoostVersion,str(gt[2])))
254  if str(gt[2]) not in boost_snapshot_map.keys():
255  tagSnapshotBoostVersion = None
256  minIov = None
257  tagSnapshotBoostVersion, minIov = self.process_tag_boost_version(t, timetype, tagSnapshotBoostVersion, minIov, gt[2])
258  if tagSnapshotBoostVersion is not None:
259  boost_snapshot_map[str(gt[2])] = tagSnapshotBoostVersion
260  else:
261  continue
262  else:
263  tagSnapshotBoostVersion = boost_snapshot_map[str(gt[2])]
264  if sm.cmp_boost_version( gtBoostVersion, tagSnapshotBoostVersion )<0:
265  logging.error('The snapshot from tag used by gt %s (consuming ver: %s) has an incompatible combined boost version %s' %(gt[0],gtBoostVersion,tagSnapshotBoostVersion))
266  invalid_gts.append( ( gt[0], gtBoostVersion ) )
267  if len(invalid_gts)==0:
268  if ngt>0:
269  logging.info('boost version for the tag validated in %s referencing Gts' %(ngt))
270  else:
271  logging.info('No GT referencing this tag found.')
272  else:
273  logging.error( 'boost version for the tag is invalid.')
274  return invalid_gts
275 
276  def update_tag_boost_version_in_db( self, t, tagBoostVersion, minIov, update ):
277  cursor = self.db.cursor()
278  now = datetime.datetime.utcnow()
279  if update:
280  cursor.execute('UPDATE TAG_METADATA SET MIN_SERIALIZATION_V=:BOOST_V, MIN_SINCE=:MIN_IOV, MODIFICATION_TIME=:NOW WHERE TAG_NAME = :NAME',( tagBoostVersion,minIov,now,t))
281  else:
282  cursor.execute('INSERT INTO TAG_METADATA ( TAG_NAME, MIN_SERIALIZATION_V, MIN_SINCE, MODIFICATION_TIME ) VALUES ( :NAME, :BOOST_V, :MIN_IOV, :NOW )',(t, tagBoostVersion,minIov,now))
283  logging.info('Minimum boost version for the tag updated.')
284 
285  def update_tags( self ):
286  cursor = self.db.cursor()
287  self.version_db = version_db( self.db )
288  self.version_db.fetch_cmssw_boost_map()
289  self.version_db.fetch_boost_run_map()
290  tags = {}
291  wpars = ()
292  if self.args.name is not None:
293  stmt0 = 'SELECT NAME FROM TAG WHERE NAME = :TAG_NAME'
294  wpars = (self.args.name,)
295  cursor.execute(stmt0,wpars);
296  rows = cursor.fetchall()
297  found = False
298  for r in rows:
299  found = True
300  break
301  if not found:
302  raise Exception('Tag %s does not exists in the database.' %self.args.name )
303  tags[self.args.name] = None
304  stmt1 = 'SELECT MIN_SERIALIZATION_V, MIN_SINCE, CAST(MODIFICATION_TIME AS TIMESTAMP(0)) FROM TAG_METADATA WHERE TAG_NAME = :NAME'
305  cursor.execute(stmt1,wpars);
306  rows = cursor.fetchall()
307  for r in rows:
308  tags[self.args.name] = (r[0],r[1],r[2])
309  else:
310  stmt0 = 'SELECT NAME FROM TAG WHERE NAME NOT IN ( SELECT TAG_NAME FROM TAG_METADATA) ORDER BY NAME'
311  nmax = 100
312  if self.args.max is not None:
313  nmax = self.args.max
314  if self.args.all:
315  nmax = -1
316  if nmax >=0:
317  stmt0 = 'SELECT NAME FROM (SELECT NAME FROM TAG WHERE NAME NOT IN ( SELECT TAG_NAME FROM TAG_METADATA ) ORDER BY NAME) WHERE ROWNUM<= :MAXR'
318  wpars = (nmax,)
319  cursor.execute(stmt0,wpars);
320  rows = cursor.fetchall()
321  for r in rows:
322  tags[r[0]] = None
323  stmt1 = 'SELECT T.NAME NAME, TM.MIN_SERIALIZATION_V MIN_SERIALIZATION_V, TM.MIN_SINCE MIN_SINCE, CAST(TM.MODIFICATION_TIME AS TIMESTAMP(0)) MODIFICATION_TIME FROM TAG T, TAG_METADATA TM WHERE T.NAME=TM.TAG_NAME AND CAST(TM.MODIFICATION_TIME AS TIMESTAMP(0)) < (SELECT MAX(INSERTION_TIME) FROM IOV WHERE IOV.TAG_NAME=TM.TAG_NAME) ORDER BY NAME'
324  nmax = nmax-len(tags)
325  if nmax >=0:
326  stmt1 = 'SELECT NAME, MIN_SERIALIZATION_V, MIN_SINCE, MODIFICATION_TIME FROM (SELECT T.NAME NAME, TM.MIN_SERIALIZATION_V MIN_SERIALIZATION_V, TM.MIN_SINCE MIN_SINCE, CAST(TM.MODIFICATION_TIME AS TIMESTAMP(0)) MODIFICATION_TIME FROM TAG T, TAG_METADATA TM WHERE T.NAME=TM.TAG_NAME AND CAST(TM.MODIFICATION_TIME AS TIMESTAMP(0)) < (SELECT MAX(INSERTION_TIME) FROM IOV WHERE IOV.TAG_NAME=TM.TAG_NAME) ORDER BY NAME) WHERE ROWNUM<= :MAXR'
327  wpars = (nmax,)
328  cursor.execute(stmt1,wpars);
329  rows = cursor.fetchall()
330  i = 0
331  for r in rows:
332  i += 1
333  if nmax >=0 and i>nmax:
334  break
335  tags[r[0]] = (r[1],r[2],r[3])
336  logging.info( 'Processing boost version for %s tags' %len(tags))
337  count = 0
338  for t in sorted(tags.keys()):
339  count += 1
340  try:
341  update = False
342  cursor.execute('SELECT TIME_TYPE FROM TAG WHERE NAME= :TAG_NAME',(t,))
343  timetype = cursor.fetchone()[0]
344  self.iovs = None
345  logging.info('************************************************************************')
346  logging.info('Tag [%s] %s - timetype: %s' %(count,t,timetype))
347  tagBoostVersion = None
348  minIov = None
349  timeCut = None
350  if tags[t] is not None:
351  update = True
352  tagBoostVersion = tags[t][0]
353  minIov = tags[t][1]
354  timeCut = tags[t][2]
355  tagBoostVersion, minIov = self.process_tag_boost_version( t, timetype, tagBoostVersion, minIov, timeCut, self.args.validate )
356  if tagBoostVersion is None:
357  continue
358  logging.debug('boost versions in the %s iovs: %s' %(len(self.iovs),str(self.versionIovs)))
359  if self.args.validate:
360  invalid_gts = self.validate_boost_version( t, timetype, tagBoostVersion )
361  if len(invalid_gts)>0:
362  with open('invalid_tags_in_gts.txt','a') as error_file:
363  for gt in invalid_gts:
364  error_file.write('Tag %s (boost %s) is invalid for GT %s ( boost %s) \n' %(t,tagBoostVersion,gt[0],gt[1]))
365  if len(self.iovs):
366  if self.iovs[0][0]<minIov:
367  minIov = self.iovs[0]
368  self.update_tag_boost_version_in_db( t, tagBoostVersion, minIov, update )
369  self.db.commit()
370  except Exception as e:
371  logging.error(str(e))
372 
373  def insert_boost_run( self ):
374  cursor = self.db.cursor()
375  self.version_db = version_db( self.db )
376  if self.args.min_ts is None:
377  raise Exception("Run %s has not been found in the database - please provide an explicit TimeType value with the min_ts parameter ." %self.args.since )
378  self.version_db.insert_boost_run_range( self.args.since, self.args.label, self.args.min_ts )
379  self.db.commit()
380  logging.info('boost version %s inserted with since %s' %(self.args.label,self.args.since))
381 
382  def list_boost_run( self ):
383  cursor = self.db.cursor()
384  self.version_db = version_db( self.db )
385  self.version_db.fetch_boost_run_map()
386  headers = ['Run','Run start time','Boost Version','Insertion time']
387  print_table( headers, self.version_db.boost_run_map )
388 
390  cursor = self.db.cursor()
391  tag = self.args.tag_name
392  cursor.execute('SELECT TIME_TYPE FROM TAG WHERE NAME= :TAG_NAME',(tag,))
393  rows = cursor.fetchall()
394  timeType = None
395  t_modificationTime = None
396  for r in rows:
397  timeType = r[0]
398  if timeType is None:
399  raise Exception("Tag %s does not exist in the database." %tag)
400  cursor.execute('SELECT MAX(INSERTION_TIME) FROM IOV WHERE TAG_NAME= :TAG_NAME',(tag,))
401  rows = cursor.fetchall()
402  for r in rows:
403  t_modificationTime = r[0]
404  if t_modificationTime is None:
405  raise Exception("Tag %s does not have any iov stored." %tag)
406  logging.info('Tag %s - timetype: %s' %(tag,timeType))
407  cursor.execute('SELECT MIN_SERIALIZATION_V, MIN_SINCE, MODIFICATION_TIME FROM TAG_METADATA WHERE TAG_NAME= :TAG_NAME',(tag,))
408  rows = cursor.fetchall()
409  tagBoostVersion = None
410  minIov = None
411  v_modificationTime = None
412  for r in rows:
413  tagBoostVersion = r[0]
414  minIov = r[1]
415  v_modificationTime = r[2]
416  if v_modificationTime is not None:
417  if t_modificationTime > v_modificationTime:
418  logging.warning('The minimum boost version stored is out of date.')
419  else:
420  logging.info('The minimum boost version stored is up to date.')
421  mt = '-'
422  if v_modificationTime is not None:
423  mt = str(v_modificationTime)
424  r_tagBoostVersion = None
425  if self.args.rebuild or self.args.full:
426  self.version_db = version_db( self.db )
427  self.version_db.fetch_boost_run_map()
428  timeCut = None
429  logging.info('Calculating minimum boost version for the available iovs...')
430  r_tagBoostVersion, r_minIov = self.process_tag_boost_version( tag, timeType, tagBoostVersion, minIov, timeCut )
431  print('# Currently stored: %s (min iov:%s)' %(tagBoostVersion,minIov))
432  print('# Last update: %s' %mt)
433  print('# Last update on the iovs: %s' %str(t_modificationTime))
434  if self.args.rebuild or self.args.full:
435  print('# Based on the %s available IOVs: %s (min iov:%s)' %(len(self.iovs),r_tagBoostVersion,r_minIov))
436  if self.args.full:
437  headers = ['Run','Boost Version']
438  print_table( headers, self.versionIovs )
439 
440 import optparse
441 import argparse
442 
443 def main():
444  tool = conddb_tool()
445  parser = argparse.ArgumentParser(description='CMS conddb command-line tool for serialiation metadata. For general help (manual page), use the help subcommand.')
446  parser.add_argument('--db', type=str, help='The target database: pro ( for prod ) or dev ( for prep ). default=pro')
447  parser.add_argument("--auth","-a", type=str, help="The path of the authentication file")
448  parser.add_argument('--verbose', '-v', action='count', help='The verbosity level')
449  parser_subparsers = parser.add_subparsers(title='Available subcommands')
450  parser_update_tags = parser_subparsers.add_parser('update_tags', description='Update the existing tag headers with the boost version')
451  parser_update_tags.add_argument('--name', '-n', type=str, help='Name of the specific tag to process (default=None - in this case all of the tags will be processed.')
452  parser_update_tags.add_argument('--max', '-m', type=int, help='the maximum number of tags processed',default=100)
453  parser_update_tags.add_argument('--all',action='store_true', help='process all of the tags with boost_version = None')
454  parser_update_tags.add_argument('--validate',action='store_true', help='validate the tag/boost version under processing')
455  parser_update_tags.set_defaults(func=tool.update_tags,accessType='w')
456  parser_insert_boost_version = parser_subparsers.add_parser('insert', description='Insert a new boost version range in the run map')
457  parser_insert_boost_version.add_argument('--label', '-l',type=str, help='The boost version label',required=True)
458  parser_insert_boost_version.add_argument('--since', '-s',type=int, help='The since validity (run number)',required=True)
459  parser_insert_boost_version.add_argument('--min_ts', '-t',type=str, help='The since validity (Time timetype)', required=False)
460  parser_insert_boost_version.set_defaults(func=tool.insert_boost_run,accessType='w')
461  parser_list_boost_versions = parser_subparsers.add_parser('list', description='list the boost versions in the run map')
462  parser_list_boost_versions.set_defaults(func=tool.list_boost_run,accessType='r')
463  parser_show_version = parser_subparsers.add_parser('show_tag', description='Display the minimum boost version for the specified tag (the value stored, by default)')
464  parser_show_version.add_argument('tag_name',help='The name of the tag')
465  parser_show_version.add_argument('--rebuild','-r',action='store_true',default=False,help='Re-calculate the minimum boost versio ')
466  parser_show_version.add_argument('--full',action='store_true',default=False,help='Recalulate the minimum boost version, listing the versions in the iov sequence')
467  parser_show_version.set_defaults(func=tool.show_tag_boost_version,accessType='r')
468  args = parser.parse_args()
469  tool.args = args
470  if args.verbose >=1:
471  tool.logger.setLevel(logging.DEBUG)
472  tool.connect()
473  return args.func()
474  else:
475  try:
476  tool.connect()
477  sys.exit( args.func())
478  except Exception as e:
479  logging.error(e)
480  sys.exit(1)
481 
482 if __name__ == '__main__':
483  main()
conddb_version_mgr.conddb_tool.update_tags
def update_tags(self)
Definition: conddb_version_mgr.py:285
conddb_version_mgr.main
def main()
Definition: conddb_version_mgr.py:443
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
conddb_version_mgr.version_db.fetch_cmssw_boost_map
def fetch_cmssw_boost_map(self)
Definition: conddb_version_mgr.py:60
conddb_version_mgr.print_table
def print_table(headers, table)
Definition: conddb_version_mgr.py:23
conddb_version_mgr.version_db
Definition: conddb_version_mgr.py:54
conddb_version_mgr.version_db.lookup_boost_in_cmssw
def lookup_boost_in_cmssw(self, cmssw_version)
Definition: conddb_version_mgr.py:97
conddb_version_mgr.conddb_tool.insert_boost_run
def insert_boost_run(self)
Definition: conddb_version_mgr.py:373
conddb_version_mgr.conddb_tool.args
args
Definition: conddb_version_mgr.py:148
conddb_version_mgr.version_db.db
db
Definition: conddb_version_mgr.py:56
conddb_version_mgr.conddb_tool.version_db
version_db
Definition: conddb_version_mgr.py:147
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
conddb_version_mgr.conddb_tool.versionIovs
versionIovs
Definition: conddb_version_mgr.py:155
conddb_version_mgr.version_db.__init__
def __init__(self, db)
Definition: conddb_version_mgr.py:55
conddb_version_mgr.version_db.insert_cmssw_boost
def insert_cmssw_boost(self, cmssw_version, boost_version)
Definition: conddb_version_mgr.py:93
str
#define str(s)
Definition: TestProcessor.cc:52
conddb_version_mgr.conddb_tool.connect
def connect(self)
Definition: conddb_version_mgr.py:157
conddb_version_mgr.conddb_tool.show_tag_boost_version
def show_tag_boost_version(self)
Definition: conddb_version_mgr.py:389
conddb_version_mgr.conddb_tool.validate_boost_version
def validate_boost_version(self, t, timetype, tagBoostVersion)
Definition: conddb_version_mgr.py:235
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
conddb_version_mgr.conddb_tool.__init__
def __init__(self)
Definition: conddb_version_mgr.py:145
Exception
conddb_time.string_to_timestamp
def string_to_timestamp(sdt)
Definition: conddb_time.py:25
mps_setup.append
append
Definition: mps_setup.py:85
conddb_version_mgr.version_db.fetch_boost_run_map
def fetch_boost_run_map(self)
Definition: conddb_version_mgr.py:69
conddb_version_mgr.version_db.insert_boost_run_range
def insert_boost_run_range(self, run, boost_version, min_ts)
Definition: conddb_version_mgr.py:78
conddb_version_mgr.conddb_tool
Definition: conddb_version_mgr.py:144
conddb_version_mgr.conddb_tool.iovs
iovs
Definition: conddb_version_mgr.py:154
conddb_version_mgr.version_db.populate_for_gts
def populate_for_gts(self)
Definition: conddb_version_mgr.py:137
conddb_version_mgr.conddb_tool.update_tag_boost_version_in_db
def update_tag_boost_version_in_db(self, t, tagBoostVersion, minIov, update)
Definition: conddb_version_mgr.py:276
conddb_version_mgr.version_db.cmssw_boost_map
cmssw_boost_map
Definition: conddb_version_mgr.py:57
conddb_version_mgr.conddb_tool.list_boost_run
def list_boost_run(self)
Definition: conddb_version_mgr.py:382
main
Definition: main.py:1
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
conddb_version_mgr.version_db.boost_run_map
boost_run_map
Definition: conddb_version_mgr.py:58
conddb_version_mgr.conddb_tool.logger
logger
Definition: conddb_version_mgr.py:149
conddb_version_mgr.conddb_tool.process_tag_boost_version
def process_tag_boost_version(self, t, timetype, tagBoostVersion, minIov, timeCut, validate)
Definition: conddb_version_mgr.py:180
conddb_version_mgr.conddb_tool.db
db
Definition: conddb_version_mgr.py:146