diff --git a/Control/AthenaCommon/python/AthOptionsParser.py b/Control/AthenaCommon/python/AthOptionsParser.py index f1f3fc1d51f4060eb2f1200015e01ec23f83e196..ddd8a529b1a312a97cae6daa05a40b9f0bb4434e 100644 --- a/Control/AthenaCommon/python/AthOptionsParser.py +++ b/Control/AthenaCommon/python/AthOptionsParser.py @@ -35,6 +35,9 @@ _userlongopts = [ "pycintex_minvmem=", "cppyy_minvmem", "minimal", # private, undocumented "threads=", + "evtMax=", #will set theApp.EvtMax just before theApp.run() in runbatch.py + "skipEvents=",#will set svcMgr.EventSelector.SkipEvents just before theApp.run() in runbatch.py + "filesInput=" #will set the AthenaCommonFlags.FilesInput job option and lock it ] _allowed_values = { @@ -50,6 +53,10 @@ _allowed_values = { _error_msg = """\ Accepted command line options: + --evtMax=<numEvents> ... Max number of events to process (only used in batch mode) + --skipEvents=<numEvents> ... Number of events to skip (only used in batch mode) + --filesInput=<files> ... Set the FilesInput job property + (comma-separated list, which can include wild characters) -b, --batch ... batch mode [DEFAULT] -i, --interactive ... interactive mode --no-display prompt, but no graphics display @@ -150,8 +157,8 @@ def parse(chk_tcmalloc=True): opts.cppyy_minvmem = None # artificial vmem bump around cppyy's import opts.minimal = False # private, undocumented opts.user_opts = [] # left-over opts after '-' - - + opts.evtMax = None # evtMax on command line (or None if unspecified) + opts.skipEvents = None # skipEvents on command line (or None if unspecified) ldpreload = os.getenv('LD_PRELOAD') or '' @@ -394,6 +401,34 @@ def parse(chk_tcmalloc=True): elif opt in ("--debugWorker",): opts.debug_worker = True + elif opt in("--filesInput",): + #set the jps.AthenaCommonFlags.FilesInput property + from AthenaCommonFlags import jobproperties as jps + from glob import glob + #split string by , character + #and for each use glob to expand path + files = [] + for fe in arg.split(","): + files += glob(fe) + jps.AthenaCommonFlags.FilesInput.set_Value_and_Lock(files) + + elif opt in("--evtMax",): + from AthenaCommonFlags import jobproperties as jps + try: arg = int(arg) + except Exception,err: + print "ERROR: --evtMax option - ",err + _help_and_exit() + opts.evtMax = arg + jps.AthenaCommonFlags.EvtMax.set_Value_and_Lock(arg) + elif opt in("--skipEvents",): + from AthenaCommonFlags import jobproperties as jps + try: arg = int(arg) + except Exception,err: + print "ERROR: --skipEvents option - ",err + _help_and_exit() + opts.skipEvents = arg + jps.AthenaCommonFlags.SkipEvents.set_Value_and_Lock(arg) + # Unconditionally set this environment (see JIRA ATEAM-241) # This behavior can be controlled by a flag, if needed os.environ['LIBC_FATAL_STDERR_']='1' diff --git a/Control/AthenaCommon/share/runbatch.py b/Control/AthenaCommon/share/runbatch.py index 2e699c5d7ff468e93139b899c8f04c010f81d56e..d5019aa1c62b5fbe06148f57e07515381b7fe187 100755 --- a/Control/AthenaCommon/share/runbatch.py +++ b/Control/AthenaCommon/share/runbatch.py @@ -8,6 +8,13 @@ # athena.py <myJobOptions.py> runbatch.py try: + #first check if command-line evtMax or skipEvents options were provided + if opts.evtMax != None: + theApp.EvtMax = jps.AthenaCommonFlags.EvtMax() + if opts.skipEvents != None: + if hasattr(svcMgr,"EventSelector"): + svcMgr.EventSelector.SkipEvents = jps.AthenaCommonFlags.SkipEvents() + theApp.run() # runs until theApp.EvtMax events reached from AthenaCommon.Debugging import hookDebugger,DbgStage if DbgStage.value == "fini":