ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaCommon
share
runbatch.py
Go to the documentation of this file.
1
# File: runbatch.py
2
# Author: Wim Lavrijsen <WLavrijsen@lbl.gov>
3
4
# Code for running a batch job with athena.py, after all other
5
# job options are set.
6
#
7
# Usage:
8
# athena.py <myJobOptions.py> runbatch.py
9
10
try
:
11
theApp.run()
# runs until theApp.EvtMax events reached
12
from
AthenaCommon.Debugging
import
hookDebugger,DbgStage
13
if
DbgStage.value ==
"fini"
:
14
hookDebugger()
15
except
:
16
# print a stack trace to know something bad happened !
17
import
traceback, sys
18
traceback.print_exc(file=sys.stdout)
19
# update the exit-code
20
import
AthenaCommon.ExitCodes
as
ath_codes
21
if
theApp._exitstate == ath_codes.ALL_OK:
22
theApp._exitstate = ath_codes.UNKNOWN_EXCEPTION
23
# re-raise, in case somebody wants to do something about it
24
raise
25
finally
:
26
import
AthenaCommon.ExitCodes
as
ath_codes
27
if
theApp._exitstate != ath_codes.ALL_OK:
28
# trigger the AthenaSummarySvc
29
try
:
30
from
AthenaCommon.AppMgr
import
ServiceMgr
as
svcMgr
31
if
hasattr( svcMgr,
'AthenaSummarySvc'
):
32
from
AthenaPython
import
PyAthena
33
aths = PyAthena.py_svc(
'AthenaSummarySvc'
, iface=
'IAthenaSummarySvc'
)
34
aths.setStatus( theApp._exitstate )
35
aths.createSummary()
36
except
ImportError:
37
print
(
"import of PyAthena failed: unable to trigger AthenaSummarySvc"
)
38
theApp.exit()
# exits program, yields theApp._exitstate on shell,
39
# ok if re-thrown C++ exception: try to exit clean
Generated on
for ATLAS Offline Software by
1.17.0