|
| 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 282 of file Main.py.
◆ __init__()
| def Gaudi.Main.gaudimain.__init__ |
( |
|
self | ) |
|
Definition at line 283 of file Main.py.
284 from Configurables
import ApplicationMgr
286 if "GAUDIAPPNAME" in os.environ:
287 appMgr.AppName = str(os.environ[
"GAUDIAPPNAME"])
288 if "GAUDIAPPVERSION" in os.environ:
289 appMgr.AppVersion = str(os.environ[
"GAUDIAPPVERSION"])
290 self.log = logging.getLogger(__name__)
291 self.printsequence =
False 292 self.application =
'Gaudi::Application' The Application Manager class.
◆ _writepickle()
| def Gaudi.Main.gaudimain._writepickle |
( |
|
self, |
|
|
|
filename |
|
) |
| |
|
private |
Definition at line 352 of file Main.py.
352 def _writepickle(self, filename):
355 output = open(filename,
'wb')
357 from GaudiKernel.Proxy.Configurable
import getNeededConfigurables
360 to_dump[n] = Configuration.allConfigurables[n]
361 pickle.dump(to_dump, output, -1)
◆ generateOptsOutput()
| def Gaudi.Main.gaudimain.generateOptsOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 346 of file Main.py.
346 def generateOptsOutput(self, all=False):
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
def getAllOpts(explicit_defaults=False)
◆ generatePyOutput()
| def Gaudi.Main.gaudimain.generatePyOutput |
( |
|
self, |
|
|
|
all = False |
|
) |
| |
Definition at line 329 of file Main.py.
329 def generatePyOutput(self, all=False):
330 from pprint
import pformat
331 from collections
import defaultdict
332 optDict = defaultdict(dict)
335 c, p = key.rsplit(
'.', 1)
336 optDict[c][p] =
parseOpt(allOpts[key])
337 formatted = pformat(dict(optDict))
344 return re.sub(
r'"\n +"',
'', formatted, flags=re.MULTILINE)
def getAllOpts(explicit_defaults=False)
◆ hookDebugger()
| def Gaudi.Main.gaudimain.hookDebugger |
( |
|
self, |
|
|
|
debugger = 'gdb' |
|
) |
| |
Definition at line 400 of file Main.py.
400 def hookDebugger(self, debugger='gdb'):
402 self.log.info(
'attaching debugger to PID ' + str(os.getpid()))
403 pid = os.spawnvp(os.P_NOWAIT, debugger,
404 [debugger,
'-q',
'python',
412 os.waitpid(pid, os.WNOHANG)
◆ printconfig()
| def Gaudi.Main.gaudimain.printconfig |
( |
|
self, |
|
|
|
old_format = False, |
|
|
|
all = False |
|
) |
| |
Definition at line 364 of file Main.py.
364 def printconfig(self, old_format=False, all=False):
365 msg =
'Dumping all configurables and properties' 367 msg +=
' (different from default)' 370 print(self.generateOptsOutput(all))
372 print(self.generatePyOutput(all))
◆ run()
| def Gaudi.Main.gaudimain.run |
( |
|
self, |
|
|
|
attach_debugger, |
|
|
|
ncpus = None |
|
) |
| |
Definition at line 391 of file Main.py.
391 def run(self, attach_debugger, ncpus=None):
394 result = self.runSerial(attach_debugger)
397 result = self.runParallel(ncpus)
◆ runParallel()
| def Gaudi.Main.gaudimain.runParallel |
( |
|
self, |
|
|
|
ncpus |
|
) |
| |
Definition at line 456 of file Main.py.
456 def runParallel(self, ncpus):
457 self.setupParallelLogging()
460 c = Configurable.allConfigurables
461 self.log.info(
'-' * 80)
462 self.log.info(
'%s: Parallel Mode : %i ', __name__, ncpus)
464 (
'platrofm',
' '.join(os.uname())),
465 (
'config', os.environ.get(
'BINARY_TAG')
466 or 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__, name, value
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)
488 self.log.info(
'%s: parallel system finished, time taken: %5.4fs',
490 self.log.info(
'-' * 80)
◆ runSerial()
| def Gaudi.Main.gaudimain.runSerial |
( |
|
self, |
|
|
|
attach_debugger |
|
) |
| |
Definition at line 416 of file Main.py.
416 def runSerial(self, attach_debugger):
418 from GaudiKernel.Proxy.Configurable
import expandvars
424 from GaudiKernel.Proxy.Configurable
import Configurable
426 self.log.debug(
'runSerial: apply options')
428 conf_dict[
'ApplicationMgr.JobOptionsType'] =
'"NONE"' 430 if self.printsequence:
431 conf_dict[
'ApplicationMgr.PrintAlgsSequence'] =
'true' 433 if hasattr(Configurable,
"_configurationLocked"):
434 Configurable._configurationLocked =
True 439 self.log.debug(
'-' * 80)
440 self.log.debug(
'%s: running in serial mode', __name__)
441 self.log.debug(
'-' * 80)
448 sysTime =
time() - sysStart
449 self.log.debug(
'-' * 80)
450 self.log.debug(
'%s: serial system finished, time taken: %5.4fs',
452 self.log.debug(
'-' * 80)
def create(cls, appType, opts)
def getAllOpts(explicit_defaults=False)
◆ setupParallelLogging()
| def Gaudi.Main.gaudimain.setupParallelLogging |
( |
|
self | ) |
|
Definition at line 294 of file Main.py.
294 def setupParallelLogging(self):
299 import multiprocessing
301 from time
import ctime
303 datetime = datetime.replace(
' ',
'_')
304 outfile = open(
'gaudirun-%s.log' % (datetime),
'w')
306 streamhandler = logging.StreamHandler(stream=outfile)
307 console = logging.StreamHandler()
309 formatter = logging.Formatter(
310 "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
312 streamhandler.setFormatter(formatter)
313 console.setFormatter(formatter)
317 self.log = multiprocessing.log_to_stderr()
318 self.log.setLevel(logging.INFO)
319 self.log.name =
'Gaudi/Main.py Logger' 320 self.log.handlers = []
322 self.log.addHandler(streamhandler)
323 self.log.addHandler(console)
324 self.log.removeHandler(console)
326 self.log.setLevel = logging.INFO
◆ writeconfig()
| def Gaudi.Main.gaudimain.writeconfig |
( |
|
self, |
|
|
|
filename, |
|
|
|
all = False |
|
) |
| |
Definition at line 375 of file Main.py.
375 def writeconfig(self, filename, all=False):
376 write = {
".pkl":
lambda filename, all: self._writepickle(filename),
377 ".py":
lambda filename, all: open(filename,
"w").write(self.generatePyOutput(all) +
"\n"),
378 ".opts":
lambda filename, all: open(filename,
"w").write(self.generateOptsOutput(all) +
"\n"),
380 from os.path
import splitext
381 ext = splitext(filename)[1]
383 write[ext](filename, all)
385 log.error(
"Unknown file type '%s'. Must be any of %r.", ext,
◆ application
| Gaudi.Main.gaudimain.application |
◆ log
◆ printsequence
| Gaudi.Main.gaudimain.printsequence |
The documentation for this class was generated from the following file: