|
| def | __init__ (self) |
| |
| def | setupParallelLogging (self) |
| |
| def | generatePyOutput (self, all=False) |
| |
| def | generateOptsOutput (self, all=False) |
| |
| def | printconfig (self, old_format=False, all=False) |
| |
| def | writeconfig (self, filename, all=False) |
| |
| def | run (self, attach_debugger, ncpus=None) |
| |
| def | hookDebugger (self, debugger='gdb') |
| |
| def | runSerial (self, attach_debugger) |
| |
| def | runParallel (self, ncpus) |
| |
Definition at line 34 of file Main.py.
| def Gaudi.Main.gaudimain.__init__ |
( |
|
self | ) |
|
Definition at line 35 of file Main.py.
36 from Configurables
import ApplicationMgr
38 if "GAUDIAPPNAME" in os.environ:
39 appMgr.AppName = str(os.environ[
"GAUDIAPPNAME"])
40 if "GAUDIAPPVERSION" in os.environ:
41 appMgr.AppVersion = str(os.environ[
"GAUDIAPPVERSION"])
42 self.
log = logging.getLogger(__name__)
The Application Manager class.
| def Gaudi.Main.gaudimain._writepickle |
( |
|
self, |
|
|
|
filename |
|
) |
| |
|
private |
Definition at line 99 of file Main.py.
102 output = open(filename,
'wb')
104 from GaudiKernel.Proxy.Configurable
import getNeededConfigurables
107 to_dump[n] = Configuration.allConfigurables[n]
108 pickle.dump(to_dump, output, -1)
def _writepickle(self, filename)
| def Gaudi.Main.gaudimain.generateOptsOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 86 of file Main.py.
87 from pprint
import pformat
88 conf_dict = Configuration.configurationDict(all)
90 names = conf_dict.keys()
93 props = conf_dict[n].keys()
96 out.append(
'%s.%s = %s;' % (n, p,
toOpt(conf_dict[n][p])))
def generateOptsOutput(self, all=False)
| def Gaudi.Main.gaudimain.generatePyOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 81 of file Main.py.
82 from pprint
import pformat
83 conf_dict = Configuration.configurationDict(all)
84 return pformat(conf_dict)
def generatePyOutput(self, all=False)
| def Gaudi.Main.gaudimain.hookDebugger |
( |
|
self, |
|
|
|
debugger = 'gdb' |
|
) |
| |
Definition at line 150 of file Main.py.
152 self.log.info(
'attaching debugger to PID ' + str(os.getpid()))
153 pid = os.spawnvp(os.P_NOWAIT, debugger,
154 [debugger,
'-q',
'python',
162 os.waitpid(pid, os.WNOHANG)
def hookDebugger(self, debugger='gdb')
| def Gaudi.Main.gaudimain.printconfig |
( |
|
self, |
|
|
|
old_format = False, |
|
|
|
all = False |
|
) |
| |
Definition at line 111 of file Main.py.
112 msg =
'Dumping all configurables and properties' 114 msg +=
' (different from default)' 116 conf_dict = Configuration.configurationDict(all)
def generateOptsOutput(self, all=False)
def generatePyOutput(self, all=False)
def printconfig(self, old_format=False, all=False)
| def Gaudi.Main.gaudimain.run |
( |
|
self, |
|
|
|
attach_debugger, |
|
|
|
ncpus = None |
|
) |
| |
Definition at line 138 of file Main.py.
138 def run(self, attach_debugger, ncpus=None):
140 if os.environ.get(
'GAUDIRUN_USE_OLDINIT'):
141 result = self.runSerialOld(attach_debugger)
def run(self, attach_debugger, ncpus=None)
def runParallel(self, ncpus)
def runSerial(self, attach_debugger)
| def Gaudi.Main.gaudimain.runParallel |
( |
|
self, |
|
|
|
ncpus |
|
) |
| |
Definition at line 227 of file Main.py.
231 c = Configurable.allConfigurables
232 self.log.info(
'-' * 80)
233 self.log.info(
'%s: Parallel Mode : %i ', __name__, ncpus)
235 (
'platrofm',
' '.join(os.uname())),
236 (
'config', os.environ.get(
'BINARY_TAG')
237 or os.environ.get(
'CMTCONFIG')),
238 (
'app. name', os.environ.get(
'GAUDIAPPNAME')),
239 (
'app. version', os.environ.get(
'GAUDIAPPVERSION')),
241 self.log.info(
'%s: %30s : %s ', __name__, name, value
244 events = str(c[
'ApplicationMgr'].EvtMax)
246 events =
"Undetermined" 247 self.log.info(
'%s: Events Specified : %s ', __name__, events)
248 self.log.info(
'-' * 80)
250 Parall = gpp.Coord(ncpus, c, self.
log)
253 self.log.info(
'MAIN.PY : received %s from Coordinator' % (sc))
256 sysTime =
time() - sysStart
257 self.log.name =
'Gaudi/Main.py Logger' 258 self.log.info(
'-' * 80)
259 self.log.info(
'%s: parallel system finished, time taken: %5.4fs',
261 self.log.info(
'-' * 80)
263 def setupParallelLogging(self)
def runParallel(self, ncpus)
| def Gaudi.Main.gaudimain.runSerial |
( |
|
self, |
|
|
|
attach_debugger |
|
) |
| |
Definition at line 166 of file Main.py.
168 from GaudiKernel.Proxy.Configurable
import expandvars
174 from GaudiKernel.Proxy.Configurable
import Configurable, getNeededConfigurables
176 self.log.debug(
'runSerial: apply options')
177 conf_dict = {
'ApplicationMgr.JobOptionsType':
'"NONE"'}
181 for c
in Configurable.allConfigurables.values():
182 if hasattr(c,
'getValuedProperties'):
183 c.getValuedProperties()
186 c = Configurable.allConfigurables[n]
187 for p, v
in c.getValuedProperties().items():
190 if hasattr(Configurable,
"PropertyReference")
and type(
191 v) == Configurable.PropertyReference:
197 elif type(v) == long:
199 conf_dict[
'{}.{}'.
format(n, p)] = str(v)
202 conf_dict[
'ApplicationMgr.PrintAlgsSequence'] =
'true' 204 if hasattr(Configurable,
"_configurationLocked"):
205 Configurable._configurationLocked =
True 210 self.log.debug(
'-' * 80)
211 self.log.debug(
'%s: running in serial mode', __name__)
212 self.log.debug(
'-' * 80)
219 sysTime =
time() - sysStart
220 self.log.debug(
'-' * 80)
221 self.log.debug(
'%s: serial system finished, time taken: %5.4fs',
223 self.log.debug(
'-' * 80)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
def hookDebugger(self, debugger='gdb')
def create(cls, appType, opts)
def runSerial(self, attach_debugger)
| def Gaudi.Main.gaudimain.setupParallelLogging |
( |
|
self | ) |
|
Definition at line 46 of file Main.py.
51 import multiprocessing
53 from time
import ctime
55 datetime = datetime.replace(
' ',
'_')
56 outfile = open(
'gaudirun-%s.log' % (datetime),
'w')
58 streamhandler = logging.StreamHandler(stream=outfile)
59 console = logging.StreamHandler()
61 formatter = logging.Formatter(
62 "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
64 streamhandler.setFormatter(formatter)
65 console.setFormatter(formatter)
69 self.
log = multiprocessing.log_to_stderr()
70 self.log.setLevel(logging.INFO)
71 self.log.name =
'Gaudi/Main.py Logger' 72 self.log.handlers = []
74 self.log.addHandler(streamhandler)
75 self.log.addHandler(console)
76 self.log.removeHandler(console)
78 self.log.setLevel = logging.INFO
def setupParallelLogging(self)
| def Gaudi.Main.gaudimain.writeconfig |
( |
|
self, |
|
|
|
filename, |
|
|
|
all = False |
|
) |
| |
Definition at line 122 of file Main.py.
123 write = {
".pkl":
lambda filename, all: self.
_writepickle(filename),
124 ".py":
lambda filename, all: open(filename,
"w").write(self.
generatePyOutput(all) +
"\n"),
125 ".opts":
lambda filename, all: open(filename,
"w").write(self.
generateOptsOutput(all) +
"\n"),
127 from os.path
import splitext
128 ext = splitext(filename)[1]
130 write[ext](filename, all)
132 log.error(
"Unknown file type '%s'. Must be any of %r.", ext,
def _writepickle(self, filename)
def generateOptsOutput(self, all=False)
def generatePyOutput(self, all=False)
def writeconfig(self, filename, all=False)
| Gaudi.Main.gaudimain.application |
| Gaudi.Main.gaudimain.printsequence |
The documentation for this class was generated from the following file: