12 parser = argparse.ArgumentParser()
13 parser.add_argument(
"-v", help=
"increase output verbosity", action=
"count", default=0)
14 parser.add_argument(
"-f",
"--file", dest=
"filename", help=
"json file (menu, prescale set, or bunch group set)")
15 parser.add_argument(
"--db", dest=
"dbalias", help=
"TriggerDB connection alias")
16 parser.add_argument(
"--smk", type = int, help=
"SuperMaster key (when accessing menu or job options")
17 parser.add_argument(
"--l1psk", type = int, help=
"L1 PrescalesSet key (when accessing L1 prescales")
18 parser.add_argument(
"--hltpsk", type = int, help=
"HLT PrescalesSet key (when accessing L1 prescales")
19 parser.add_argument(
"--bgsk", type = int, help=
"BunchGroupSet key (when accessing bunch groups")
20 parser.add_argument(
"--monk", type = int, help=
"Monitoring Groups key (when accessing monitoring groups)")
21 parser.add_argument(
"--print", dest=
"doPrint", help=
"Prints the loaded information", action=
"store_true", default =
False)
22 parser.add_argument(
"-w",
"--write", dest=
"doWrite", help=
"Writes the loaded information to a file", action=
"store_true", default =
False)
23 parser.add_argument(
"-l",
"--loglevel", dest=
"loglevel", help=
"Log level [DEBUG, INFO, WARNING] (default INFO)", default =
"INFO")
24 parser.add_argument(
"--use-crest", dest=
"useCrest", action=
"store_true",
25 help=
"Uses CREST to access the TriggerDB")
26 parser.add_argument(
"--crest-server", dest=
"crestServer", type=str, default=
"http://crest-04.cern.ch/api-v5.0",
27 help=
"CREST server (default: http://crest-04.cern.ch/api-v5.0)")
29 args = parser.parse_args()
31 logging.getLogger(
'TriggerConfigAccessBase.py').
setLevel(args.loglevel)
32 logging.getLogger(
'L1TriggerConfigAccess.py').
setLevel(args.loglevel)
33 logging.getLogger(
'HLTTriggerConfigAccess.py').
setLevel(args.loglevel)
34 log.setLevel(args.loglevel)
39 if filetype == ConfigType.L1MENU.filetype:
40 cfg = L1MenuAccess( filename = args.filename )
41 elif filetype == ConfigType.L1PS.filetype:
42 cfg = L1PrescalesSetAccess( filename = args.filename )
43 elif filetype == ConfigType.BGS.filetype:
44 cfg = BunchGroupSetAccess( filename = args.filename )
45 elif filetype == ConfigType.HLTMENU.filetype:
46 cfg = HLTMenuAccess( filename = args.filename )
47 elif filetype == ConfigType.HLTPS.filetype:
48 cfg = HLTPrescalesSetAccess( filename = args.filename )
49 elif filetype == ConfigType.HLTJO.filetype:
50 cfg = HLTJobOptionsAccess( filename = args.filename )
51 elif filetype == ConfigType.HLTMON.filetype:
52 cfg = HLTMonitoringAccess( filename = args.filename )
54 log.error(
"Can't read file %s of unknown filetype '%s'", args.filename, filetype)
59 cfg += [ L1MenuAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
60 cfg += [ HLTMenuAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
61 cfg += [ HLTJobOptionsAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
62 cfg += [ HLTMonitoringAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
64 cfg += [ L1PrescalesSetAccess( dbalias = args.dbalias, l1pskey = args.l1psk, useCrest = args.useCrest, crestServer = args.crestServer) ]
66 cfg += [ HLTPrescalesSetAccess( dbalias = args.dbalias, hltpskey = args.hltpsk, useCrest = args.useCrest, crestServer = args.crestServer) ]
68 cfg += [ BunchGroupSetAccess( dbalias = args.dbalias, bgskey = args.bgsk, useCrest = args.useCrest, crestServer = args.crestServer) ]
70 cfg += [ HLTMonitoringAccess( dbalias = args.dbalias, monikey = args.monk, useCrest = args.useCrest, crestServer = args.crestServer) ]
72 print(
"Either a file or dbalias and key need to be specified")