|
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 | basicInit (self) |
|
def | gaudiPythonInit (self) |
|
def | runSerial (self, attach_debugger) |
|
def | runParallel (self, ncpus) |
|
Definition at line 164 of file Main.py.
def Gaudi.Main.gaudimain.__init__ |
( |
|
self | ) |
|
Definition at line 168 of file Main.py.
169 from Configurables
import ApplicationMgr
171 if "GAUDIAPPNAME" in os.environ:
172 appMgr.AppName = str(os.environ[
"GAUDIAPPNAME"])
173 if "GAUDIAPPVERSION" in os.environ:
174 appMgr.AppVersion = str(os.environ[
"GAUDIAPPVERSION"])
175 self.
log = logging.getLogger(__name__)
The Application Manager class.
def Gaudi.Main.gaudimain._writepickle |
( |
|
self, |
|
|
|
filename |
|
) |
| |
|
private |
Definition at line 231 of file Main.py.
234 output = open(filename,
'wb')
239 to_dump[n] = Configuration.allConfigurables[n]
240 pickle.dump(to_dump, output, -1)
def _writepickle(self, filename)
def Gaudi.Main.gaudimain.basicInit |
( |
|
self | ) |
|
Bootstrap the application with minimal use of Python bindings.
Definition at line 294 of file Main.py.
296 Bootstrap the application with minimal use of Python bindings. 304 from GaudiKernel.Proxy.Configurable
import Configurable, getNeededConfigurables
307 if _bootstrap
is None:
310 self.log.debug(
'basicInit: instantiate ApplicationMgr')
311 self.
ip = self.
g = _bootstrap.createApplicationMgr()
313 self.log.debug(
'basicInit: apply options')
316 comp =
'ApplicationMgr' 317 props = Configurable.allConfigurables.get(comp, {})
319 props =
expandvars(props.getValuedProperties())
320 for p, v
in props.items() + [(
'JobOptionsType',
'NONE')]:
321 if not self.g.setProperty(p, str(v)):
322 self.log.error(
'Cannot set property %s.%s to %s', comp, p, v)
325 if _bootstrap.ROOT_VERSION < (6, 2, 7):
333 msp = self.g.getService(comp)
335 self.log.error(
'Cannot get service %s', comp)
337 props = Configurable.allConfigurables.get(comp, {})
339 props =
expandvars(props.getValuedProperties())
340 for p, v
in props.items():
341 if not _bootstrap.setProperty(msp, p, str(v)):
342 self.log.error(
'Cannot set property %s.%s to %s', comp, p, v)
346 comp =
'JobOptionsSvc' 347 jos = self.g.getService(comp)
349 self.log.error(
'Cannot get service %s', comp)
352 c = Configurable.allConfigurables[n]
353 if n
in [
'ApplicationMgr',
'MessageSvc']:
355 for p, v
in c.getValuedProperties().items():
358 if hasattr(Configurable,
"PropertyReference")
and type(v) == Configurable.PropertyReference:
364 elif type(v) == long:
366 _bootstrap.addPropertyToCatalogue(jos, n, p, str(v))
367 if hasattr(Configurable,
"_configurationLocked"):
368 Configurable._configurationLocked =
True 369 self.log.debug(
'basicInit: done')
def Gaudi.Main.gaudimain.gaudiPythonInit |
( |
|
self | ) |
|
Initialize the application with full Python bindings.
Definition at line 371 of file Main.py.
373 Initialize the application with full Python bindings. 375 self.log.debug(
'gaudiPythonInit: import GaudiPython')
377 self.log.debug(
'gaudiPythonInit: instantiate ApplicationMgr')
380 self.log.debug(
'gaudiPythonInit: done')
def gaudiPythonInit(self)
def Gaudi.Main.gaudimain.generateOptsOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 218 of file Main.py.
219 from pprint
import pformat
220 conf_dict = Configuration.configurationDict(all)
222 names = conf_dict.keys()
225 props = conf_dict[n].keys()
228 out.append(
'%s.%s = %s;' % (n, p,
toOpt(conf_dict[n][p])))
229 return "\n".join(out)
def generateOptsOutput(self, all=False)
def Gaudi.Main.gaudimain.generatePyOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 213 of file Main.py.
214 from pprint
import pformat
215 conf_dict = Configuration.configurationDict(all)
216 return pformat(conf_dict)
def generatePyOutput(self, all=False)
def Gaudi.Main.gaudimain.hookDebugger |
( |
|
self, |
|
|
|
debugger = 'gdb' |
|
) |
| |
Definition at line 279 of file Main.py.
281 self.log.info(
'attaching debugger to PID ' + str(os.getpid()))
282 pid = os.spawnvp(os.P_NOWAIT,
283 debugger, [debugger,
'-q',
'python', str(os.getpid())])
290 os.waitpid(pid, os.WNOHANG)
def hookDebugger(self, debugger='gdb')
def Gaudi.Main.gaudimain.printconfig |
( |
|
self, |
|
|
|
old_format = False , |
|
|
|
all = False |
|
) |
| |
Definition at line 243 of file Main.py.
244 msg =
'Dumping all configurables and properties' 246 msg +=
' (different from default)' 248 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 270 of file Main.py.
270 def run(self, attach_debugger, ncpus=None):
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 453 of file Main.py.
456 "Cannot use custom main loop in multi-process mode, check your options")
461 c = Configurable.allConfigurables
462 self.log.info(
'-' * 80)
463 self.log.info(
'%s: Parallel Mode : %i ', __name__, ncpus)
464 for name, value
in [(
'platrofm',
' '.join(os.uname())),
465 (
'config', os.environ.get(
'BINARY_TAG')
or 466 os.environ.get(
'CMTCONFIG')),
467 (
'app. name', os.environ.get(
'GAUDIAPPNAME')),
468 (
'app. version', os.environ.get(
'GAUDIAPPVERSION')),
470 self.log.info(
'%s: %30s : %s ', __name__,
471 name, value
or 'Undefined')
473 events = str(c[
'ApplicationMgr'].EvtMax)
475 events =
"Undetermined" 476 self.log.info(
'%s: Events Specified : %s ', __name__, events)
477 self.log.info(
'-' * 80)
479 Parall = gpp.Coord(ncpus, c, self.
log)
482 self.log.info(
'MAIN.PY : received %s from Coordinator' % (sc))
485 sysTime =
time() - sysStart
486 self.log.name =
'Gaudi/Main.py Logger' 487 self.log.info(
'-' * 80)
489 '%s: parallel system finished, time taken: %5.4fs', __name__, sysTime)
490 self.log.info(
'-' * 80)
492 def setupParallelLogging(self)
def runParallel(self, ncpus)
def Gaudi.Main.gaudimain.runSerial |
( |
|
self, |
|
|
|
attach_debugger |
|
) |
| |
Definition at line 382 of file Main.py.
385 os.environ.get(
'GAUDIRUN_USE_GAUDIPYTHON')):
390 self.log.debug(
'-' * 80)
391 self.log.debug(
'%s: running in serial mode', __name__)
392 self.log.debug(
'-' * 80)
398 def runner(app, nevt):
399 self.log.debug(
'initialize')
400 sc = app.initialize()
403 app.printAlgsSequences()
404 self.log.debug(
'start')
407 self.log.debug(
'run(%d)', nevt)
409 self.log.debug(
'stop')
411 self.log.debug(
'finalize')
412 app.finalize().ignore()
413 self.log.debug(
'terminate')
414 sc1 = app.terminate()
419 self.log.debug(
'status code: %s',
420 'SUCCESS' if sc.isSuccess()
else 'FAILURE')
423 if (attach_debugger ==
True):
427 statuscode = runner(self.
g, int(
428 self.ip.getProperty(
'EvtMax').
toString()))
431 self.ip.setProperty(
'ReturnCode', str(128 + 11))
434 print 'Exception:', x
436 self.ip.setProperty(
'ReturnCode',
'1')
438 if hasattr(statuscode,
"isSuccess"):
439 success = statuscode.isSuccess()
443 if not success
and self.ip.getProperty(
'ReturnCode').
toString() ==
'0':
445 self.ip.setProperty(
'ReturnCode',
'1')
446 sysTime =
time() - sysStart
447 self.log.debug(
'-' * 80)
449 '%s: serial system finished, time taken: %5.4fs', __name__, sysTime)
450 self.log.debug(
'-' * 80)
451 return int(self.ip.getProperty(
'ReturnCode').
toString())
def gaudiPythonInit(self)
def hookDebugger(self, debugger='gdb')
std::string toString(const Type &)
def runSerial(self, attach_debugger)
def Gaudi.Main.gaudimain.setupParallelLogging |
( |
|
self | ) |
|
Definition at line 178 of file Main.py.
183 import multiprocessing
185 from time
import ctime
187 datetime = datetime.replace(
' ',
'_')
188 outfile = open(
'gaudirun-%s.log' % (datetime),
'w')
190 streamhandler = logging.StreamHandler(stream=outfile)
191 console = logging.StreamHandler()
193 formatter = logging.Formatter(
194 "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
196 streamhandler.setFormatter(formatter)
197 console.setFormatter(formatter)
201 self.
log = multiprocessing.log_to_stderr()
202 self.log.setLevel(logging.INFO)
203 self.log.name =
'Gaudi/Main.py Logger' 204 self.log.handlers = []
206 self.log.addHandler(streamhandler)
207 self.log.addHandler(console)
208 self.log.removeHandler(console)
210 self.log.setLevel = logging.INFO
def setupParallelLogging(self)
def Gaudi.Main.gaudimain.writeconfig |
( |
|
self, |
|
|
|
filename, |
|
|
|
all = False |
|
) |
| |
Definition at line 254 of file Main.py.
255 write = {
".pkl":
lambda filename, all: self.
_writepickle(filename),
259 from os.path
import splitext
260 ext = splitext(filename)[1]
262 write[ext](filename, all)
264 log.error(
"Unknown file type '%s'. Must be any of %r.",
def _writepickle(self, filename)
def generateOptsOutput(self, all=False)
def generatePyOutput(self, all=False)
def writeconfig(self, filename, all=False)
Gaudi.Main.gaudimain.mainLoop = None |
|
static |
Gaudi.Main.gaudimain.printsequence |
The documentation for this class was generated from the following file: