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 from AthenaCommon.OldStyleConfig import Algorithm, AlgTool, Service
19 
20 
21 from AthenaCommon.Constants import *
22 # namespace these constants: Lvl.INFO
23 # so we can write e.g: Units.GeV
24 import AthenaCommon.Constants as Lvl
25 import AthenaCommon.SystemOfUnits as Units
26 
27 
28 from AthenaCommon import CfgMgr
29 from AthenaCommon.AppMgr import theApp
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 from AthenaCommon.AppMgr import ToolSvc, ServiceMgr, theAuditorSvc
39 theApp.setOutputLevel( globals()[opts.loglevel] )
40 theApp._opts = opts # FIXME
41 
42 
43 if not "POOL_OUTMSG_LEVEL" in os.environ:
44  os.environ[ "POOL_OUTMSG_LEVEL" ] = str(globals()[opts.loglevel])
45 
46 
47 include( "AthenaCommon/Atlas.UnixStandardJob.py" )
48 include.block( "AthenaCommon/Atlas.UnixStandardJob.py" )
49 
50 from PyUtils.Helpers import ROOT6Setup
51 ROOT6Setup(batch=not opts.interactive)
52 
53 
54 
58 
59 
60 from AthenaCommon.Include import IncludeError
61 try:
62  include( "$HOME/.athenarc" )
63 except IncludeError:
64  pass
65 
66 
67 from AthenaCommon.ResourceLimits import SetMaxLimits
69 del SetMaxLimits
70 del sys.modules[ 'AthenaCommon.ResourceLimits' ]
71 
72 
73 if opts.interactive:
74  import atexit
75 
76  # finalize on exit (^D)
77  atexit.register( theApp.exit )
78 
79  del atexit
80 
81 if opts.command:
82  _msg.info( 'executing CLI (-c) command: "%s"' % opts.command )
83  exec (opts.command)
84 
85 if DbgStage.value == "conf":
86  hookDebugger()
87 
88 if opts.showincludes:
89  AthCIncMod.marker = AthCIncMod.__marker__ # reset
90 del AthCIncMod
91 
92 if opts.do_leak_chk:
93  from Hephaestus.Auditor import HephaestusAuditor
94  theApp.AuditAlgorithms = True
95  svcMgr.AuditorSvc += HephaestusAuditor(
96  mode = opts.memchk_mode, auditOn = opts.do_leak_chk )
97 
98 
99 
100 from AthenaCommon.ConcurrencyFlags import jobproperties as jps
101 if opts.nprocs and (opts.nprocs >= 1 or opts.nprocs==-1):
102  jps.ConcurrencyFlags.NumProcs = opts.nprocs
103  _msg.info ("configuring AthenaMP with [%s] sub-workers",
104  jps.ConcurrencyFlags.NumProcs())
105 
106  if (opts.debug_worker is True) :
107  jps.ConcurrencyFlags.DebugWorkers = True
108  _msg.info (" Workers will pause after fork until SIGUSR1 signal received")
109 
110 if (opts.threads or opts.concurrent_events) :
111 
112  if (opts.threads is None and opts.concurrent_events is not None) :
113 
114  jps.ConcurrencyFlags.NumThreads = opts.concurrent_events
115  jps.ConcurrencyFlags.NumConcurrentEvents = opts.concurrent_events
116  elif (opts.threads is not None and opts.concurrent_events is None) :
117 
118  jps.ConcurrencyFlags.NumThreads = opts.threads
119  jps.ConcurrencyFlags.NumConcurrentEvents = opts.threads
120  else :
121 
122  jps.ConcurrencyFlags.NumThreads = opts.threads
123  jps.ConcurrencyFlags.NumConcurrentEvents = opts.concurrent_events
124 
125 
126  if (jps.ConcurrencyFlags.NumProcs() > 0) :
127  _msg.info ("configuring hybrid AthenaMP/AthenaMT with [%s] concurrent threads and [%s] concurrent events per AthenaMP worker", jps.ConcurrencyFlags.NumThreads, jps.ConcurrencyFlags.NumConcurrentEvents)
128  elif (jps.ConcurrencyFlags.NumProcs() == 0) :
129  _msg.info ("configuring AthenaHive with [%s] concurrent threads and [%s] concurrent events", jps.ConcurrencyFlags.NumThreads(), jps.ConcurrencyFlags.NumConcurrentEvents())
130  else:
131  # we should never get here
132  _msg.error ("ConcurrencyFlags.NumProcs() cannot == -1 !!")
133  sys.exit()
134 
135  import AthenaCommon.AtlasThreadedJob
SystemOfUnits
Logging
python.ResourceLimits.SetMaxLimits
def SetMaxLimits()
max out soft resource limits to hard ones -----------------------------—
Definition: ResourceLimits.py:57
OldStyleConfig
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:319
str
Definition: BTagTrackIpAccessor.cxx:11