317 parser = argparse.ArgumentParser(prog=
'athenaHLT.py', formatter_class=
318 lambda prog : argparse.ArgumentDefaultsHelpFormatter(prog, max_help_position=32, width=100),
319 usage =
'%(prog)s [OPTION]... -f FILE jobOptions',
321 parser.expert_groups = []
324 g = parser.add_argument_group(
'Options')
325 g.add_argument(
'jobOptions', nargs=
'?', help=
'job options, CA module or JSON file')
326 g.add_argument(
'--threads', metavar=
'N', type=int, default=1, help=
'number of threads')
327 g.add_argument(
'--nprocs', metavar=
'N', type=int, default=1, help=
'number of children to fork')
328 g.add_argument(
'--concurrent-events', metavar=
'N', type=int, help=
'number of concurrent events if different from --threads')
329 g.add_argument(
'--log-level',
'-l', metavar=
'LVL', type=arg_log_level, default=
'INFO,ERROR', help=
'OutputLevel of athena,POOL')
330 g.add_argument(
'--precommand',
'-c', metavar=
'CMD', action=
'append', default=[],
331 help=
'Python commands executed before job options or database configuration')
332 g.add_argument(
'--postcommand',
'-C', metavar=
'CMD', action=
'append', default=[],
333 help=
'Python commands executed after job options or database configuration')
334 g.add_argument(
'--interactive',
'-i', action=
'store_true', help=
'interactive mode')
335 g.add_argument(
'--help',
'-h', nargs=
'?', choices=[
'all'], action=MyHelp, help=
'show help')
337 g = parser.add_argument_group(
'Input/Output')
338 g.add_argument(
'--file',
'--filesInput',
'-f', action=
'append', help=
'input RAW file')
339 g.add_argument(
'--save-output',
'-o', metavar=
'FILE', help=
'output file name')
340 g.add_argument(
'--number-of-events',
'--evtMax',
'-n', metavar=
'N', type=int, default=-1, help=
'processes N events (<=0 means all)')
341 g.add_argument(
'--skip-events',
'--skipEvents',
'-k', metavar=
'N', type=int, default=0, help=
'skip N first events')
342 g.add_argument(
'--loop-files', action=
'store_true', help=
'loop over input files if no more events')
345 g = parser.add_argument_group(
'Performance and debugging')
346 g.add_argument(
'--debug',
'-d', nargs=
'?', const=
'child', choices=[
'parent',
'child'],
347 help=
'attach debugger (to child by default)')
348 g.add_argument(
'--script-after-fork', metavar=
'CMD', help=
'Execute a command after forking. The command has to be in the'
349 ' form "whichProc:cmd" where whichProc is one of [mother,firstFork,allForks] and cmd can contain a format'
350 ' string {pid} which will be replaced with the PID of the corresponding process (mother or fork).')
351 g.add_argument(
'--perfmon', action=
'store_true', help=
'enable PerfMon')
352 g.add_argument(
'--tcmalloc', action=
'store_true', default=
True, help=
'use tcmalloc')
353 g.add_argument(
'--stdcmalloc', action=
'store_true', help=
'use stdcmalloc')
354 g.add_argument(
'--stdcmath', action=
'store_true', help=
'use stdcmath library')
355 g.add_argument(
'--imf', action=
'store_true', default=
True, help=
'use Intel math library')
356 g.add_argument(
'--show-includes',
'-s', action=
'store_true', help=
'show printout of included files')
357 g.add_argument(
'--timeout', metavar=
'MSEC', default=60*60*1000, help=
'timeout in milliseconds')
360 g = parser.add_argument_group(
'Database')
361 g.add_argument(
'--use-database',
'-b', action=
'store_true',
362 help=
'configure from trigger database, reading keys from COOL if not specified')
363 g.add_argument(
'--db-server', metavar=
'DB', default=
'TRIGGERDB_RUN3', help=
'DB server name')
364 g.add_argument(
'--smk', type=int, default=
None, help=
'Super Master Key')
365 g.add_argument(
'--l1psk', type=int, default=
None, help=
'L1 prescale key')
366 g.add_argument(
'--hltpsk', type=int, default=
None, help=
'HLT prescale key')
367 g.add_argument(
'--dump-config', action=
'store_true', help=
'Dump joboptions JSON file')
368 g.add_argument(
'--dump-config-exit', action=
'store_true', help=
'Dump joboptions JSON file and exit')
371 g = parser.add_argument_group(
'Online Histogramming')
372 g.add_argument(
'--oh-monitoring',
'-M', action=
'store_true',
373 help=
'enable OH monitoring')
374 g.add_argument(
'--oh-interval', metavar=
'SEC', type=int, default=5,
375 help=
'seconds between histogram publications.')
378 g = parser.add_argument_group(
'Conditions')
379 g.add_argument(
'--run-number',
'-R', metavar=
'RUN', type=int,
380 help=
'run number (if None, read from first event)')
381 g.add_argument(
'--lb-number',
'-L', metavar=
'LBN', type=int,
382 help=
'lumiblock number (if None, read from first event)')
383 g.add_argument(
'--sor-time', type=arg_sor_time,
384 help=
'The Start Of Run time. Three formats are accepted: '
385 '1) the string "now", for current time; '
386 '2) the number of nanoseconds since epoch (e.g. 1386355338658000000 or int(time.time() * 1e9)); '
387 '3) human-readable "20/11/18 17:40:42.3043". If not specified the sor-time is read from COOL')
388 g.add_argument(
'--detector-mask', metavar=
'MASK', type=arg_detector_mask,
389 help=
'detector mask (if None, read from COOL), use string "all" to enable all detectors')
392 g = parser.add_argument_group(
'Expert')
393 parser.expert_groups.append(g)
394 g.add_argument(
'--joboptionsvc-type', metavar=
'TYPE', default=
'TrigConf::JobOptionsSvc', help=
'JobOptionsSvc type')
395 g.add_argument(
'--msgsvc-type', metavar=
'TYPE', default=
'TrigMessageSvc', help=
'MessageSvc type')
396 g.add_argument(
'--partition',
'-p', metavar=
'NAME', default=
'athenaHLT', help=
'partition name')
397 g.add_argument(
'--no-ers-signal-handlers', action=
'store_true', help=
'disable ERS signal handlers')
398 g.add_argument(
'--preloadlib', metavar=
'LIB', help=
'preload an arbitrary library')
399 g.add_argument(
'--unique-log-files',
'-ul', action=
'store_true', help=
'add pid/timestamp to worker log files')
400 g.add_argument(
'--debug-fork', action=
'store_true', help=
'Dump open files/threads during forking')
401 g.add_argument(
'--hltresult-size', metavar=
'MB', type=int, default=10, help=
'Maximum HLT result size in MB')
402 g.add_argument(
'--extra-l1r-robs', metavar=
'ROBS', type=arg_eval, default=[],
403 help=
'List of additional ROB IDs that are considered part of the L1 result and passed to the HLT')
404 g.add_argument(
'--ros2rob', metavar=
'DICT', type=arg_ros2rob, default={},
405 help=
'Either a string in the form of python dictionary that contains ros-rob mappings '
406 'or a file path that contains such string. For example, /path/to/rosmap.txt or '
407 '{"ROS0":[0x11205,0x11206],"ROS1":[2120005,2120006]}')
408 g.add_argument(
'--cfgdict', metavar=
'DICT', type=arg_eval, default={},
409 help=
'HLTMPPy config dictionary with additional options, e.g.: '
410 '--cfgdict \'{"global": {"log_root" : "/tmp"}}\'')
412 (args, unparsed_args) = parser.parse_known_args()
416 import AthenaCommon.Logging
417 AthenaCommon.Logging.log.setLevel(getattr(logging, args.log_level[0]))
418 AthenaCommon.Logging.log.setFormat(
"%(asctime)s Py:%(name)-31s %(levelname)7s %(message)s")
419 if args.show_includes:
420 from AthenaCommon.Include
import include
421 include.setShowIncludes(
True )
424 if not args.concurrent_events:
425 args.concurrent_events = args.threads
427 if args.loop_files
and args.number_of_events<0:
428 log.warning(
"Looping over files without specifying number of events will run forever!")
431 if args.interactive
and not (args.use_database
or args.jobOptions.endswith(
'.json')):
432 args.interactive =
False
435 from TrigPSC
import PscConfig
438 if args.use_database:
440 PscConfig.forcePSK = (args.hltpsk
is not None)
454 from TrigPSC.PscDefaultFlags
import defaultOnlineFlags
458 if not args.use_database
and not args.jobOptions.endswith(
'.json'):
459 PscConfig.unparsedArguments = unparsed_args
460 for flag_arg
in unparsed_args:
461 flags.fillFromString(flag_arg)
463 PscConfig.interactive = args.interactive
464 PscConfig.exitAfterDump = args.dump_config_exit
466 flags.PerfMon.doFastMonMT = args.perfmon
467 flags.Trigger.Online.useOnlineTHistSvc = args.oh_monitoring
470 from HLTMPPy.runner
import runHLTMPPy