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