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

◆ main()

def conddb_version_mgr.main ( )

Definition at line 443 of file conddb_version_mgr.py.

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 

◆ print_table()

def conddb_version_mgr.print_table (   headers,
  table 
)

Definition at line 23 of file conddb_version_mgr.py.

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 

References print(), and str.

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

conddb_version_mgr.main
def main()
Definition: conddb_version_mgr.py:443
conddb_version_mgr.print_table
def print_table(headers, table)
Definition: conddb_version_mgr.py:23
str
#define str(s)
Definition: TestProcessor.cc:51
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46