8 msg = logging.getLogger(__name__)
18 help=
'Use ComponentAccumulator base configuration')
19 parser.add_argument(
'--verbose',
'--debug', action=
'store_true', help=
'Set transform loglevel to DEBUG')
20 parser.add_argument(
'--loglevel', choices=
list(stdLogLevels), help=
'Set transform logging level')
21 parser.add_argument(
'--argJSON',
'--argjson', metavar=
'FILE', help=
'File containing JSON serialised argument dictionary')
22 parser.add_argument(
'--dumpargs', action=
'store_true', help=
'Dump transform arguments and exit')
23 parser.add_argument(
'--showGraph', action=
'store_true', help=
'Show multi-step transform graph, then exit')
24 parser.add_argument(
'--showPath', action=
'store_true', help=
'Show execution path only, then exit')
25 parser.add_argument(
'--showSteps', action=
'store_true', help=
'Show list of executor steps only, then exit')
26 parser.add_argument(
'--dumpPickle', metavar=
'FILE', help=
'Interpret command line arguments and write them out as a pickle file')
27 parser.add_argument(
'--dumpJSON', metavar=
'FILE', help=
'Interpret command line arguments and write them out as a JSON file')
29 help=
'Base name for job reports (default name is "jobReport" for most reports, but "metadata" for classic prodsys XML)')
30 parser.add_argument(
'--reportType', type=argFactory(
trfArgClasses.argList, runarg=
False), nargs=
'+', metavar=
'TYPE',
31 help=
'Job reports to produce: valid values are "text", "json", "classic", "pilotPickle" and "gpickle"')
32 parser.add_argument(
'--execOnly', action=
'store_true',
33 help=
'Exec the first substep only, replacing the transform process (no job reports and the return code will be from the substep process)')
35 help=
'Explicitly set environment variables for an executor (default is all substeps).'
36 ' N.B. this setting is passed to the shell, so reference to shell variables is allowed, e.g.'
39 help=
'Manually include/exclude the Intel IMF maths library '
40 '(otherwise this is disabled for base releases < 17.7, enabled otherwise)')
42 help=
'Switch preload of the tcmalloc library (disabled by default)')
44 help=
'Steer the transform by manipulating the execution graph before the execution path is calculated. '
45 'Format is substep:{in,out}{+-}DATA,{in,out}{+-}DATA,... to modify the substep\'s input/output '
46 ' by adding/removing a data type. e.g. RAWtoALL:in-RDO,in+RDO_TRIG would remove RDO and add '
47 'RDO_TRIG to the list of valid input datatypes for the RAWtoALL substep. See current version of '
48 'trfArgClasses.argSubstepSteering.steeringAlises for supported aliases. '
49 'https://twiki.cern.ch/twiki/bin/view/AtlasComputing/TransformSteering')
59 def addAthenaArguments(parser, maxEventsDefaultSubstep='first', addValgrind=True, addPerfMon=True, addVTune=True):
60 parser.defineArgGroup(
'Athena',
'General Athena Options')
61 parser.add_argument(
'--athenaopts', group =
'Athena', type=argFactory(
trfArgClasses.argSubstepList, splitter=
' ', runarg=
False), nargs=
"+", metavar=
'substep:ATHENAOPTS',
62 help=
'Extra options to pass to athena. Opts will split on spaces. '
63 'Multiple substep options can be given with --athenaopts=\'sutbstep1:--opt1 --opt2[=foo] ...\' \'substep2:--opt3\''
64 'Without substep specified, options will be used for all substeps.')
65 parser.add_argument(
'--command',
'-c', group =
'Athena', type=argFactory(
trfArgClasses.argString, runarg=
False), metavar=
'COMMAND',
66 help=
'Run %(metavar)s before all else')
67 parser.add_argument(
'--athena', group =
'Athena', type=argFactory(
trfArgClasses.argString, runarg=
False), metavar=
'ATHENA',
68 help=
'Use %(metavar)s as the athena executable')
70 metavar=
'substep:PREEXEC',
71 help=
'Python code to execute before main job options are included (can be optionally limited to a single substep)')
73 metavar=
'substep:PREINCLUDE',
74 help=
'Python configuration fragment to include before main job options (can be optionally limited to a single substep). Will split on commas: frag1.py,frag2.py is understood.')
76 metavar=
'substep:POSTEXEC',
77 help=
'Python code to execute after main job options are included (can be optionally limited to a single substep)')
79 metavar=
'substep:POSTINCLUDE',
80 help=
'Python configuration fragment to include after main job options (can be optionally limited '
81 'to a single substep). Will split on commas: frag1.py,frag2.py is understood.')
83 metavar=
'substep:SPLITCONFIG',
84 help=
'Configuration file to internally split job into multiple parts (can be optionally limited to a single substep)')
85 parser.add_argument(
'--maxEvents', group=
'Athena', type=argFactory(
trfArgClasses.argSubstepInt, defaultSubstep=maxEventsDefaultSubstep),
86 nargs=
'+', metavar=
'substep:maxEvents',
87 help=
'Set maximum events for each processing step (default substep is "{0}")'.
format(maxEventsDefaultSubstep))
88 parser.add_argument(
'--skipEvents', group=
'Athena', nargs=
'+', type=argFactory(
trfArgClasses.argSubstepInt, defaultSubstep=
'first'),
89 help=
'Number of events to skip over in the first processing step (skipping substep can be overridden)')
90 parser.add_argument(
'--asetup', group=
'Athena', type=argFactory(
trfArgClasses.argSubstep, runarg=
False), nargs=
'+', metavar=
'substep:ASETUP',
91 help=
'asetup command string to be run before this substep is executed')
92 parser.add_argument(
'--runInContainer', group=
'Athena', type=argFactory(
trfArgClasses.argSubstep, runarg=
False), nargs=
'+', metavar=
'substep:CONTAINER_OS',
93 help=
'Set the substep to run in a container with the specified OS. Requires the --athena flag')
95 help=
'Allowed "efficiency" for processing events - used to ensure output file has enough events (default 1.0)')
97 metavar=
'dataType:targetSizeInMegaBytes', nargs=
'+', group=
'Athena',
98 help=
'Set the target merge size for an AthenaMP output file type (give size in MB). '
99 'Note that the special value 0 means do not merge this output file; negative values mean '
100 'always merge to a single file. Globbing is supported, e.g. "DESD_*:500" is understood. '
101 'Special datatype "ALL" can be used as a default for all datatypes not explicitly '
102 'given their own value or glob matched.')
104 nargs=
'+', metavar=
'substep:Strategy', group=
'Athena',
105 help=
'Set the AthenaMP scheduling strategy for a particular substep. Default is unset.')
108 help=
'Change AthenaMP setup to read event numbers from event orders files')
110 metavar=
'N', group=
'Athena',
111 help=
'Set AthenaMP to fork after processing N events (default is to fork immediately after '
115 help=
'SharedWriter mode active')
116 parser.add_argument(
'--parallelCompression',
119 help=
'Delegate event data compression to the workers while using SharedWriter')
122 help=
'Switch AthenaMP to the Event Service configuration')
125 help=
'Multithreaded mode active')
130 help=
'Multiprocess mode active')
133 help=
'Remove intermediate input/output files of multi step TRF')
147 parser.defineArgGroup(
'PerfMon',
'General PerfMon Options')
148 parser.add_argument(
'--perfmon',
151 help=
'Enable PerfMon (fastmonmt [default], fullmonmt, or none)',
156 parser.defineArgGroup(
'Valgrind',
'General Valgrind Options')
164 metavar =
"substep:BOOL",
165 help =
'Enable Valgrind'
168 '--valgrindDefaultOpts',
174 metavar =
"substep:BOOL",
175 help =
'Enable default Valgrind options'
178 '--valgrindExtraOpts',
185 metavar =
'OPT1,OPT2,OPT3',
186 help =
'Extra options passed to Valgrind when running Athena. ' +
187 'Options starting with "-" must be given as ' +
188 '--valgrindExtraOpts=\'--opt1=foo,--opt2=bar,...\''
193 parser.defineArgGroup(
'VTune',
'General VTune Options')
201 metavar =
"substep:BOOL",
202 help =
'Enable VTune'
205 '--vtuneDefaultOpts',
211 metavar =
"substep:BOOL",
212 help =
'Enable default VTune options'
222 metavar =
'OPT1,OPT2,OPT3',
223 help =
'Extra options passed to VTune when running Athena. ' +
224 'Options starting with "-" must be given as ' +
225 '--vtuneExtraOpts=\'-opt1=foo,-opt2=bar,...\''
232 parser.defineArgGroup(
'Detector',
'General detector configuration options, for simulation and reconstruction')
233 parser.add_argument(
'--DBRelease', group =
'Detector', type=argFactory(
trfArgClasses.argSubstep, runarg=
False), metavar=
'substep:DBRelease', nargs=
'+',
234 help=
'Use DBRelease instead of ORACLE. Give either a DBRelease tarball file (e.g., DBRelease-21.7.1.tar.gz) or cvmfs DBRelease directory (e.g., 21.7.1 or current')
236 help=
'Conditions tag to set')
237 parser.add_argument(
'--geometryVersion', group=
'Detector', type=argFactory(
trfArgClasses.argSubstep), metavar=
'substep:GeoVersion', nargs=
'+',
238 help=
'ATLAS geometry version tag')
240 help=
'Switch to SQLite Geometry DB')
242 help=
'Manual setting of SQLite Geometry DB path. For testing purposes only')
244 help=
'Manual beam type setting')
245 parser.add_argument(
'--runNumber',
'--RunNumber', group=
'Detector', type=argFactory(
trfArgClasses.argInt),
246 help=
'Manual run number setting')
251 parser.defineArgGroup(
'Metadata',
'Metadata arguments that will be passed into the transform')
252 parser.add_argument(
'--AMIConfig',
'--AMI', type=argFactory(
trfArgClasses.argString), help=
'Configure transform with AMI tag parameters', group=
"Metadata")
254 help=
'AMI tag from which this job was defined - this option simply writes the '
255 'relevant AMI tag value into the output metadata, it does not configure the job (use --AMIConfig for that)')
256 parser.add_argument(
'--taskid', type=argFactory(
trfArgClasses.argString, runarg=
False), help=
"Task identification number", group=
"Metadata")
257 parser.add_argument(
'--jobid', type=argFactory(
trfArgClasses.argString, runarg=
False), help=
"Job identification number", group=
"Metadata")
258 parser.add_argument(
'--attempt', type=argFactory(
trfArgClasses.argString, runarg=
False), help=
"Job attempt number", group=
"Metadata")
271 parser.defineArgGroup(
'Primary DPDs',
'Primary DPD File Options')
275 listRAWtoDPD = [
'StreamDAOD_PIXELVALID',
'StreamDRAW_RPVLL',
'StreamDRAW_ZMUMU',
'StreamDRAW_DIMU',
'StreamDRAW_EGZ',
'StreamDRAW_TAULH',
'StreamDRAW_JET',
'StreamDRAW_EGJPSI',
'StreamDRAW_TAUMUH',
276 'StreamDRAW_EMU',
'StreamDRAW_BCID1',
'StreamDRAW_BCID2',
'StreamDRAW_BCID3',
'StreamDRAW_BCID4',
'StreamDRAW_TOPSLMU',
'StreamDAOD_IDNCB',
'StreamDAOD_SCTVALID']
277 listESDtoDPD = [
'StreamDESDM_ALLCELLS',
'StreamDESDM_EOVERP',
'StreamDESDM_IDALIGN',
'StreamDESDM_EGAMMA',
'StreamDESDM_MCP',
'StreamDESDM_TILEMU',
'StreamDESDM_PHOJET',
'StreamDESDM_SGLEL',
'StreamDESDM_SLTTMU',
'StreamDESDM_CALJET',
278 'StreamDESDM_EXOTHIP',
'StreamDAOD_IDTRKVALID',
'StreamDAOD_IDTIDE',
'StreamDAOD_IDTRKLUMI',
'StreamDAOD_IDPIXLUMI',
'StreamDAOD_L1CALO1',
'StreamDAOD_L1CALO2',
'StreamDAOD_L1CALO3',
'StreamDAOD_L1CALO4',
'StreamDAOD_L1CALO5',
'StreamDESD_DEDX']
280 matchedOutputList = [([
'r2a'], listRAWtoDPD + listESDtoDPD), ([
'a2d'], listAODtoDPD)]
281 for substep, dpdList
in matchedOutputList:
282 for dpdName
in [ dpd.replace(
'Stream',
'')
for dpd
in dpdList ]:
283 msg.debug(
'Handling {0}'.
format(dpdName))
284 if pick
is None or dpdName
in pick:
286 dpdType = dpdName.split(
'_')[0]
288 parser.add_argument(
'--output' + dpdName +
'File',
290 group =
'Primary DPDs', metavar=dpdName.upper(),
291 help=
'DPD {0} output {1} file'.
format(dpdType, dpdName))
292 elif 'AOD' in dpdType:
293 parser.add_argument(
'--output' + dpdName +
'File',
295 group =
'Primary DPDs', metavar=dpdName.upper(),
296 help=
'DPD {0} output {1} file'.
format(dpdType, dpdName))
297 elif 'ESD' in dpdType:
298 parser.add_argument(
'--output' + dpdName +
'File',
300 group =
'Primary DPDs', metavar=dpdName.upper(),
301 help=
'DPD {0} output {1} file'.
format(dpdType, dpdName))
303 msg.warning(
'Unrecognised primary DPD type: {0}'.
format(dpdName))
306 for executor
in transform.executors:
307 if hasattr(executor,
'substep')
and executor.substep
in substep:
308 executor.outDataUpdate([dpdName])
309 if executor.name
in substep:
310 executor.outDataUpdate([dpdName])
313 msg.warning(
'PrimaryDPDFlags not available - cannot add primary DPD arguments')
330 def __init__(self, name, type = None, substeps = [], argclass = None, treeNames = None, help = None):
358 self.
_substeps = [
'RAWtoALL',
'AODtoDPD']
404 extraDPDs.append(
dpdType(
'NTUP_SCT', substeps=[
'r2e']))
405 extraDPDs.append(
dpdType(
'NTUP_MUONCALIB', substeps=[
'r2e',
'r2a'], treeNames=[
'PatternNtupleMaker/Segments']))
406 extraDPDs.append(
dpdType(
'NTUP_TRKVALID', substeps=[
'r2e']))
407 extraDPDs.append(
dpdType(
'NTUP_FASTMON', substeps=[
'a2t',
'a2d',
'e2a']))
408 extraDPDs.append(
dpdType(
'NTUP_LARNOISE', substeps=[
'e2d'], treeNames=[
'CollectionTree']))
409 extraDPDs.append(
dpdType(
'NTUP_WZ', substeps=[
'e2d'], treeNames=[
'physics']))
410 extraDPDs.append(
dpdType(
'NTUP_TRT', substeps=[
'e2d'], treeNames=[
'MyCollectionTree']))
411 extraDPDs.append(
dpdType(
'NTUP_HECNOISE', substeps=[
'e2d'], treeNames=[
'HECNoise']))
412 extraDPDs.append(
dpdType(
'NTUP_ENHBIAS', substeps=[
'e2d',
'e2a'], treeNames=[
'vertices']))
413 extraDPDs.append(
dpdType(
'NTUP_TRUTH', substeps=[
'a2d'], treeNames=[
'truth']))
414 extraDPDs.append(
dpdType(
'NTUP_SUSYTRUTH', substeps=[
'a2d'], treeNames=[
'truth']))
415 extraDPDs.append(
dpdType(
'NTUP_HIGHMULT', substeps=[
'e2a'], treeNames=[
'MinBiasTree']))
416 extraDPDs.append(
dpdType(
'NTUP_PROMPTPHOT', substeps=[
'e2d',
'a2d'], treeNames=[
"PAUReco",
"HggUserData"]))
418 extraDPDs.append(
dpdType(
'NTUP_MCPTP', substeps=[
'a2d'], help=
"Ntuple file for MCP Tag and Probe"))
419 extraDPDs.append(
dpdType(
'NTUP_MCPScale', substeps=[
'a2d'], help=
"Ntuple file for MCP scale calibration"))
421 extraDPDs.append(
dpdType(
'NTUP_FastCaloSim', substeps=[
'e2d']))
422 extraDPDs.append(
dpdType(
'NTUP_PILEUP', substeps=[
'a2da']))
426 extraDPDs.append(
dpdType(
'NTUP_TRIGCOST'))
427 extraDPDs.append(
dpdType(
'NTUP_TRIGRATE', treeNames=[
'metadata']))
429 extraDPDs.append(
dpdType(
'DAOD_HSG2'))
430 extraDPDs.append(
dpdType(
'DESDM_ZMUMU'))
442 def addExtraDPDTypes(parser, pick=None, transform=None, multipleOK=False, NTUPMergerArgs = False):
443 parser.defineArgGroup(
'Additional DPDs',
'Extra DPD file types')
448 for dpd
in extraDPDs:
449 if pick
is None or dpd.name
in pick:
450 if dpd.name.startswith(
'NTUP'):
451 parser.add_argument(
'--input' + dpd.name +
'File',
452 type=argFactory(dpd.argclass, multipleOK=
True, io=
'input', type=dpd.type, treeNames=dpd.treeNames),
453 group =
'Additional DPDs', metavar=dpd.name.upper(), nargs=
'+',
454 help=dpd.help
if dpd.help
else 'DPD input {0} file'.
format(dpd.name))
455 parser.add_argument(
'--output' + dpd.name +
'_MRGFile',
456 type=argFactory(dpd.argclass, multipleOK=multipleOK, type=dpd.type, treeNames=dpd.treeNames),
457 group =
'Additional DPDs', metavar=dpd.name.upper(),
458 help=dpd.help
if dpd.help
else 'DPD output merged {0} file'.
format(dpd.name))
462 for dpd
in extraDPDs:
463 if pick
is None or dpd.name
in pick:
464 msg.debug(
'Adding DPD {0} ({1}, {2}, {3}, {4})'.
format(dpd.name, dpd.type, dpd.substeps, dpd.treeNames, dpd.argclass))
467 parser.add_argument(
'--output' + dpd.name +
'File',
468 type=argFactory(dpd.argclass, name=dpd.name.upper(), multipleOK=multipleOK, type=dpd.type, treeNames=dpd.treeNames),
469 group =
'Additional DPDs', metavar=dpd.name.upper(),
470 help=dpd.help
if dpd.help
else 'DPD output {0} file'.
format(dpd.name))
472 parser.add_argument(
'--output' + dpd.name +
'File',
473 type=argFactory(dpd.argclass, multipleOK=multipleOK, type=dpd.type),
474 group =
'Additional DPDs', metavar=dpd.name.upper(),
475 help=dpd.help
if dpd.help
else 'DPD output {0} file'.
format(dpd.name))
477 for executor
in transform.executors:
478 if hasattr(executor,
'substep')
and executor.substep
in dpd.substeps:
479 executor.outDataUpdate([dpd.name])
480 if executor.name
in dpd.substeps:
481 executor.outDataUpdate([dpd.name])
485 parser.defineArgGroup(
'File Validation',
'Standard file validation switches')
487 group=
'File Validation', help=
'If FALSE skip both input and output file validation (default TRUE; warning - do not use this option in production jobs!)')
488 parser.add_argument(
'--inputFileValidation', type = argFactory(
trfArgClasses.argBool), metavar=
'BOOL',
489 group=
'File Validation', help=
'If FALSE skip input file validation (default TRUE; warning - do not use this option in production jobs!)')
490 parser.add_argument(
'--outputFileValidation', type = argFactory(
trfArgClasses.argBool), metavar=
'BOOL',
491 group=
'File Validation', help=
'If FALSE skip output file validation (default TRUE; warning - do not use this option in production jobs!)')
493 parser.add_argument(
'--parallelFileValidation', type = argFactory(
trfArgClasses.argBool), metavar=
'BOOL',
495 group=
'File Validation', help=
'Parallelise file validation if True')
496 parser.add_argument(
'--multithreadedFileValidation', type = argFactory(
trfArgClasses.argBool), metavar=
'BOOL',
498 group=
'File Validation', help=
'Use multithreaded ROOT file validation if True')
501 parser.defineArgGroup(
'pool',
'Parallel Job Processor arguments')
502 parser.add_argument(
'----parallelProcessPool', group=
'pool', type=argFactory(
trfArgClasses.argInt, runarg=
False), help=
'Number of processes in pool requested (int)')
505 parser.defineArgGroup(
'Validation',
'Standard job validation switches')
506 parser.add_argument(
'--ignoreFiles',
'--ignoreFilters', group=
'Validation', type=argFactory(
trfArgClasses.argList, splitter=
',', runarg=
False),
507 help=
'Files containing error patterns to be ignored during logfile scans (will split on commas; use "None" to disable the standard "atlas_error_mask.db")', nargs=
'+')
508 parser.add_argument(
'--ignorePatterns', group=
'Validation', type=argFactory(
trfArgClasses.argList, splitter=
',', runarg=
False),
509 help=
'Regexp error patterns to be ignored during logfile scans (will be applied as a search against the whole logfile line)', nargs=
'+')
510 parser.add_argument(
'--ignoreErrors', type=argFactory(
trfArgClasses.argBool, runarg=
False), metavar=
"BOOL", group=
'Validation',
511 help=
'Ignore ERROR lines in logfiles (use with care this can mask serious problems; --ignorePatterns is prefered)')
513 help=
'Enable check of output events against input events (default: True)', group=
'Validation',
518 parser.defineArgGroup(
'Trigger',
'Trigger Related Options')
519 parser.add_argument(
'--triggerConfig',
521 metavar=
'substep=triggerConf',
522 help=
'Trigger configuration string (substep aware argument - default is to run trigger in RDOtoRDOTrigger step, '
523 'use syntax SUBSTEP=TRIGCONF if you want to run trigger somewhere else). '
524 'N.B. This argument uses EQUALS (=) to separate the substep name from the value.',
525 group=
'Trigger', nargs=
'+')
527 parser.add_argument(
'--trigFilterList',
529 help=
'Trigger filter list (multiple values can be given separately or split on commas; only understood in RAWtoALL)',
534 parser.defineArgGroup(
'Tea',
'Tea Making Options (for testing)')
535 parser.add_argument(
'--cupsOfTea', group=
'Tea', type=argFactory(
trfArgClasses.argInt), help=
'Number of cups of tea requested (int)')
536 parser.add_argument(
'--teaType', group=
'Tea', type=argFactory(
trfArgClasses.argString), help=
'Requested flavour of tea (string)')
537 parser.add_argument(
'--mugVolume', group=
'Tea', type=argFactory(
trfArgClasses.argFloat), help=
'How large a cup to use (float)')
538 parser.add_argument(
'--drinkers', group=
'Tea', nargs=
'+', type=argFactory(
trfArgClasses.argList), help=
'Who is drinking tea (list)')