ATLAS Offline Software
Loading...
Searching...
No Matches
Preparation.py
Go to the documentation of this file.
2import AthenaCommon.Include as AthCIncMod
3if opts.showincludes:
4 AthCIncMod.marker = ' -#-' # distinguish bootstrap from other jo-code
5
6
7if opts.interactive:
8 from AthenaCommon.Interactive import configureInteractivePrompt
9 configureInteractivePrompt()
10 del configureInteractivePrompt
11
12
13from AthenaCommon.Debugging import hookDebugger, allowPtrace
14allowPtrace()
15
16
17from AthenaCommon.Configurable import *
18
19
20from AthenaCommon.Constants import *
21# namespace these constants: Lvl.INFO
22# so we can write e.g: Units.GeV
23import AthenaCommon.Constants as Lvl
24import AthenaCommon.SystemOfUnits as Units
25
26
27from AthenaCommon import CfgMgr
28from AthenaCommon.AppMgr import ( athAlgSeq, theApp, ToolSvc, theAuditorSvc,
29 ServiceMgr, ServiceMgr as svcMgr )
30from AthenaCommon.Logging import log
31
32# load all entries so far into the workspace of include()
33
34if opts.interactive: # i.e. interactive
35 theApp.EventLoop = "PyAthenaEventLoopMgr" # from AthenaServices
36
37
38theApp.setOutputLevel( globals()[opts.loglevel] )
39theApp._opts = opts # FIXME
40
41
42if not "POOL_OUTMSG_LEVEL" in os.environ:
43 os.environ[ "POOL_OUTMSG_LEVEL" ] = str(globals()[opts.loglevel])
44
45
46import AthenaCommon.AtlasUnixStandardJob
47
48
52
53
54from AthenaCommon.Include import IncludeError
55try:
56 include( "$HOME/.athenarc" )
57except IncludeError:
58 pass
59
60
61from AthenaCommon.ResourceLimits import SetMaxLimits
62SetMaxLimits()
63del SetMaxLimits
64del sys.modules[ 'AthenaCommon.ResourceLimits' ]
65
66
67if opts.interactive:
68 import atexit
69
70 # finalize on exit (^D)
71 atexit.register( theApp.exit )
72
73 del atexit
74
75if opts.command:
76 _msg.info( 'executing CLI (-c) command: "%s"' % opts.command )
77 exec (opts.command)
78
79if DbgStage.value == "conf":
80 hookDebugger()
81
82if opts.showincludes:
83 AthCIncMod.marker = AthCIncMod.__marker__ # reset
84del AthCIncMod
85
86
87
88from AthenaCommon.ConcurrencyFlags import jobproperties as jps
89if opts.nprocs and (opts.nprocs >= 1 or opts.nprocs==-1):
90 # MPI and AthenaMP don't mix
91 if opts.mpi:
92 _msg.error("Cannot run AthenaMP with MPI")
93 sys.exit()
94 jps.ConcurrencyFlags.NumProcs = opts.nprocs
95 _msg.info ("configuring AthenaMP with [%s] sub-workers",
96 jps.ConcurrencyFlags.NumProcs())
97
98 if (opts.debug_worker is True) :
99 jps.ConcurrencyFlags.DebugWorkers = True
100 _msg.info (" Workers will pause after fork until SIGUSR1 signal received")
101
102if (opts.threads or opts.concurrent_events) :
103
104 if (opts.threads is None and opts.concurrent_events is not None) :
105
106 jps.ConcurrencyFlags.NumThreads = opts.concurrent_events
107 jps.ConcurrencyFlags.NumConcurrentEvents = opts.concurrent_events
108 elif (opts.threads is not None and opts.concurrent_events is None) :
109
110 jps.ConcurrencyFlags.NumThreads = opts.threads
111 jps.ConcurrencyFlags.NumConcurrentEvents = opts.threads
112 else :
113
114 jps.ConcurrencyFlags.NumThreads = opts.threads
115 jps.ConcurrencyFlags.NumConcurrentEvents = opts.concurrent_events
116
117
118 if (jps.ConcurrencyFlags.NumProcs() > 0) :
119 _msg.info ("configuring hybrid AthenaMP/AthenaMT with [%s] concurrent threads and [%s] concurrent events per AthenaMP worker", jps.ConcurrencyFlags.NumThreads, jps.ConcurrencyFlags.NumConcurrentEvents)
120 elif (jps.ConcurrencyFlags.NumProcs() == 0) :
121 _msg.info ("configuring AthenaHive with [%s] concurrent threads and [%s] concurrent events", jps.ConcurrencyFlags.NumThreads(), jps.ConcurrencyFlags.NumConcurrentEvents())
122 else:
123 # we should never get here
124 _msg.error ("ConcurrencyFlags.NumProcs() cannot == -1 !!")
125 sys.exit()
126
127 import AthenaCommon.AtlasThreadedJob