CMS 3D CMS Logo

Classes | Functions
conddb_version_mgr Namespace Reference

Classes

class  conddb_tool
 
class  version_db
 

Functions

def main ()
 
def print_table (headers, table)
 

Function Documentation

def conddb_version_mgr.main ( )

Definition at line 431 of file conddb_version_mgr.py.

431 def main():
432  tool = conddb_tool()
433  parser = argparse.ArgumentParser(description='CMS conddb command-line tool for serialiation metadata. For general help (manual page), use the help subcommand.')
434  parser.add_argument('--db', type=str, help='The target database: pro ( for prod ) or dev ( for prep ). default=pro')
435  parser.add_argument("--auth","-a", type=str, help="The path of the authentication file")
436  parser.add_argument('--verbose', '-v', action='count', help='The verbosity level')
437  parser_subparsers = parser.add_subparsers(title='Available subcommands')
438  parser_update_tags = parser_subparsers.add_parser('update_tags', description='Update the existing tags headers with the boost version')
439  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.')
440  parser_update_tags.add_argument('--max', '-m', type=int, help='the maximum number of tags processed',default=100)
441  parser_update_tags.add_argument('--all',action='store_true', help='process all of the tags with boost_version = None')
442  parser_update_tags.set_defaults(func=tool.update_tags,accessType='w')
443  parser_insert_boost_version = parser_subparsers.add_parser('insert_boost_version', description='Insert a new boost version range in the run map')
444  parser_insert_boost_version.add_argument('--label', '-l',type=str, help='The boost version label',required=True)
445  parser_insert_boost_version.add_argument('--since', '-s',type=int, help='The since validity (run number)',required=True)
446  parser_insert_boost_version.set_defaults(func=tool.insert_boost_run,accessType='w')
447  parser_list_boost_versions = parser_subparsers.add_parser('list_boost_versions', description='list the boost versions in the run map')
448  parser_list_boost_versions.set_defaults(func=tool.list_boost_run,accessType='r')
449  parser_show_version = parser_subparsers.add_parser('show_boost_version', description='Display the minimum boost version for the specified tag (the value stored, by default)')
450  parser_show_version.add_argument('tag_name',help='The name of the tag')
451  parser_show_version.add_argument('--rebuild','-r',action='store_true',default=False,help='Re-calculate the minimum boost versio ')
452  parser_show_version.add_argument('--full',action='store_true',default=False,help='Recalulate the minimum boost version, listing the versions in the iov sequence')
453  parser_show_version.set_defaults(func=tool.show_tag_boost_version,accessType='r')
454  args = parser.parse_args()
455  tool.args = args
456  if args.verbose >=1:
457  tool.logger.setLevel(logging.DEBUG)
458  tool.connect()
459  return args.func()
460  else:
461  try:
462  tool.connect()
463  sys.exit( args.func())
464  except Exception as e:
465  logging.error(e)
466  sys.exit(1)
467 
def conddb_version_mgr.print_table (   headers,
  table 
)

Definition at line 22 of file conddb_version_mgr.py.

References harvestTrackValidationPlots.str.

Referenced by conddb_version_mgr.conddb_tool.list_boost_run(), and conddb_version_mgr.conddb_tool.show_tag_boost_version().

22 def print_table( headers, table ):
23  ws = []
24  for h in headers:
25  ws.append(len(h))
26  for row in table:
27  ind = 0
28  for c in row:
29  c = str(c)
30  if ind<len(ws):
31  if len(c)> ws[ind]:
32  ws[ind] = len(c)
33  ind += 1
34 
35  def printf( row ):
36  line = ''
37  ind = 0
38  for w in ws:
39  fmt = '{:<%s}' %w
40  if ind<len(ws):
41  line += (fmt.format( row[ind] )+' ')
42  ind += 1
43  print line
44  printf( headers )
45  hsep = ''
46  for w in ws:
47  fmt = '{:-<%s}' %w
48  hsep += (fmt.format('')+' ')
49  print hsep
50  for row in table:
51  printf( row )
52 
def print_table(headers, table)