2 for script
in opts.scripts:
6 if isinstance(e,SystemExit):
12 if not _msg.isEnabledFor( logging.DEBUG ):
14 exc_info = sys.exc_info()
15 tb = traceback.extract_tb( exc_info[2] )
19 if not 'AthenaCommon' in frame_info[0]:
20 short_tb.append( frame_info )
22 print (
'Shortened traceback (most recent user call last):')
23 print (
''.
join( traceback.format_list( short_tb ) ),)
24 print (
''.
join( traceback.format_exception_only( exc_info[0], exc_info[1] ) ),)
28 if not opts.interactive:
30 import AthenaCommon.ExitCodes
as ExitCodes
31 if isinstance( e, IncludeError ):
32 theApp._exitstate = ExitCodes.INCLUDE_ERROR
33 print(
'If the script is a ComponentAccumulator configuration, add a shebang (#!) '
34 'to its first line or run with the --CA option.\n')
35 elif isinstance( e, ImportError ):
36 theApp._exitstate = ExitCodes.IMPORT_ERROR
38 theApp._exitstate = ExitCodes.UNKNOWN_EXCEPTION
48 if "-h" in opts.user_opts
or "--help" in opts.user_opts:
52 from AthenaCommon.AthOptionsParser
import _error_msg
58 _msg.info(
'now loading %s ... ', opts.fromdb )
59 import AthenaCommon.ConfigurationShelve
60 AthenaCommon.ConfigurationShelve.loadJobOptionsCatalogue( opts.fromdb )
61 del AthenaCommon.ConfigurationShelve
62 if opts.fromdb.startswith(
'TempAthenaConfig.' ):
64 os.remove( opts.fromdb )
71 import PerfMonComps.PerfMonFlags
as _pmf
72 _pmf._decode_pmon_opts(opts.perfmon.split(
','))
75 if DbgStage.value ==
"init":
79 if not opts.fromdb
and opts.nprocs
and (opts.nprocs >= 1
or opts.nprocs==-1):
80 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
81 import AthenaMP.PyComps
as _amppy
82 svcMgr += _amppy.MpEvtLoopMgr(NWorkers=opts.nprocs)
85 from AthenaCommon.AthenaCommonFlags
import jobproperties
as jps
86 if jps.AthenaCommonFlags.EvtMax.statusOn:
87 theApp.EvtMax = jps.AthenaCommonFlags.EvtMax()
88 if jps.AthenaCommonFlags.SkipEvents.statusOn:
89 if hasattr(svcMgr,
"EventSelector"):
90 if not hasattr(svcMgr,
"SecondaryEventSelector"):
91 svcMgr.EventSelector.SkipEvents = jps.AthenaCommonFlags.SkipEvents()
93 _msg.warning(
'No EventSelector in svcMgr, not skipping events')
97 if not opts.interactive:
99 include(
"AthenaCommon/runbatch.py" )
105 if opts.nprocs
and (opts.nprocs >= 1
or opts.nprocs==-1):
106 _msg.warning(
'interactive mode not validated with AthenaMP')
108 _msg.info(
'entered interactive mode - have fun!' )
109 _msg.info(
'you can call theApp.run() to execute and use ctrl-d to exit' )
110 os.environ[
'PYTHONINSPECT'] =
'1'