2for 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:
33 with open(opts.scripts[0],
'r')
as f:
34 script_content = f.read(5000)
35 if "ComponentAccumulator" in script_content
or "ConfigFlags" in script_content:
36 log.warning(
"The script '%s' appears to use ComponentAccumulator syntax,", opts.scripts[0])
37 log.warning(
"but athena.py is executing it in Legacy mode.")
38 log.warning(
"FIX: Add '#!/usr/bin/env athena.py' as the first line of your script.")
46 import AthenaCommon.ExitCodes
as ExitCodes
47 if isinstance( e, IncludeError ):
48 theApp._exitstate = ExitCodes.INCLUDE_ERROR
49 print(
'If the script is a ComponentAccumulator configuration, add a shebang (#!) '
50 'to its first line or run with the --CA option.\n')
51 elif isinstance( e, ImportError ):
52 theApp._exitstate = ExitCodes.IMPORT_ERROR
54 theApp._exitstate = ExitCodes.UNKNOWN_EXCEPTION
64 if "-h" in opts.user_opts
or "--help" in opts.user_opts:
68 from AthenaCommon.AthOptionsParser
import _error_msg
74 _msg.info(
'now loading %s ... ', opts.fromdb )
75 import AthenaCommon.ConfigurationShelve
76 AthenaCommon.ConfigurationShelve.loadJobOptionsCatalogue( opts.fromdb )
77 del AthenaCommon.ConfigurationShelve
78 if opts.fromdb.startswith(
'TempAthenaConfig.' ):
80 os.remove( opts.fromdb )
87 import PerfMonComps.PerfMonFlags
as _pmf
88 _pmf._decode_pmon_opts(opts.perfmon.split(
','))
91 if DbgStage.value ==
"init":
95 if not opts.fromdb
and opts.nprocs
and (opts.nprocs >= 1
or opts.nprocs==-1):
96 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
97 import AthenaMP.PyComps
as _amppy
98 svcMgr += _amppy.MpEvtLoopMgr(NWorkers=opts.nprocs)
101 from AthenaCommon.AthenaCommonFlags
import jobproperties
as jps
102 if jps.AthenaCommonFlags.EvtMax.statusOn:
103 theApp.EvtMax = jps.AthenaCommonFlags.EvtMax()
104 if jps.AthenaCommonFlags.SkipEvents.statusOn:
105 if hasattr(svcMgr,
"EventSelector"):
106 if not hasattr(svcMgr,
"SecondaryEventSelector"):
107 svcMgr.EventSelector.SkipEvents = jps.AthenaCommonFlags.SkipEvents()
109 _msg.warning(
'No EventSelector in svcMgr, not skipping events')
113 if not opts.interactive:
115 include(
"AthenaCommon/runbatch.py" )
121 if opts.nprocs
and (opts.nprocs >= 1
or opts.nprocs==-1):
122 _msg.warning(
'interactive mode not validated with AthenaMP')
124 _msg.info(
'entered interactive mode - have fun!' )
125 _msg.info(
'you can call theApp.run() to execute and use ctrl-d to exit' )
126 os.environ[
'PYTHONINSPECT'] =
'1'
void print(char *figname, TCanvas *c1)