Gaudi.Main.gaudimain Class Reference
Inheritance diagram for Gaudi.Main.gaudimain:
Collaboration diagram for Gaudi.Main.gaudimain:

Public Member Functions

def __init__ (self)
 
def setupParallelLogging (self)
 
def generatePyOutput
 
def generateOptsOutput
 
def printconfig
 
def writeconfig
 
def run
 Instantiate and run the application. More...
 
def basicInit (self)
 
def gaudiPythonInit (self)
 
def runSerial (self)
 
def runParallel (self, ncpus)
 
def __init__ (self)
 
def setupParallelLogging (self)
 
def generatePyOutput
 
def generateOptsOutput
 
def printconfig
 
def writeconfig
 
def run
 Instantiate and run the application. More...
 
def basicInit (self)
 
def gaudiPythonInit (self)
 
def runSerial (self)
 
def runParallel (self, ncpus)
 

Public Attributes

 log
 
 printsequence
 
 ip
 
 g
 

Static Public Attributes

 mainLoop = None
 

Private Member Functions

def _writepickle (self, filename)
 
def _writepickle (self, filename)
 

Detailed Description

Definition at line 139 of file Main.py.

Constructor & Destructor Documentation

def Gaudi.Main.gaudimain.__init__ (   self)

Definition at line 143 of file Main.py.

143  def __init__(self) :
144  from Configurables import ApplicationMgr
145  appMgr = ApplicationMgr()
146  if "GAUDIAPPNAME" in os.environ:
147  appMgr.AppName = str(os.environ["GAUDIAPPNAME"])
148  if "GAUDIAPPVERSION" in os.environ:
149  appMgr.AppVersion = str(os.environ["GAUDIAPPVERSION"])
150  self.log = logging.getLogger(__name__)
151  self.printsequence = False
152 
The Application Manager class.
def __init__(self)
Definition: Main.py:143
def Gaudi.Main.gaudimain.__init__ (   self)

Definition at line 143 of file Main.py.

143  def __init__(self) :
144  from Configurables import ApplicationMgr
145  appMgr = ApplicationMgr()
146  if "GAUDIAPPNAME" in os.environ:
147  appMgr.AppName = str(os.environ["GAUDIAPPNAME"])
148  if "GAUDIAPPVERSION" in os.environ:
149  appMgr.AppVersion = str(os.environ["GAUDIAPPVERSION"])
150  self.log = logging.getLogger(__name__)
151  self.printsequence = False
152 
The Application Manager class.
def __init__(self)
Definition: Main.py:143

Member Function Documentation

def Gaudi.Main.gaudimain._writepickle (   self,
  filename 
)
private

Definition at line 205 of file Main.py.

205  def _writepickle(self, filename) :
206  #--- Lets take the first file input file as the name of the pickle file
207  import pickle
208  output = open(filename, 'wb')
209  # Dump only the the configurables that make sense to dump (not User ones)
210  from GaudiKernel.Proxy.Configurable import getNeededConfigurables
211  to_dump = {}
212  for n in getNeededConfigurables():
213  to_dump[n] = Configuration.allConfigurables[n]
214  pickle.dump(to_dump, output, -1)
215  output.close()
216 
def _writepickle(self, filename)
Definition: Main.py:205
def Gaudi.Main.gaudimain._writepickle (   self,
  filename 
)
private

Definition at line 205 of file Main.py.

205  def _writepickle(self, filename) :
206  #--- Lets take the first file input file as the name of the pickle file
207  import pickle
208  output = open(filename, 'wb')
209  # Dump only the the configurables that make sense to dump (not User ones)
210  from GaudiKernel.Proxy.Configurable import getNeededConfigurables
211  to_dump = {}
212  for n in getNeededConfigurables():
213  to_dump[n] = Configuration.allConfigurables[n]
214  pickle.dump(to_dump, output, -1)
215  output.close()
216 
def _writepickle(self, filename)
Definition: Main.py:205
def Gaudi.Main.gaudimain.basicInit (   self)
Bootstrap the application with minimal use of Python bindings.

Definition at line 252 of file Main.py.

252  def basicInit(self):
253  '''
254  Bootstrap the application with minimal use of Python bindings.
255  '''
256  try:
257  from GaudiKernel.Proxy.Configurable import expandvars
258  except ImportError:
259  # pass-through implementation if expandvars is not defined (AthenaCommon)
260  expandvars = lambda data : data
261 
262  from GaudiKernel.Proxy.Configurable import Configurable, getNeededConfigurables
263 
264  global _bootstrap
265  if _bootstrap is None:
266  _bootstrap = BootstrapHelper()
267 
268  self.log.debug('basicInit: instantiate ApplicationMgr')
269  self.ip = self.g = _bootstrap.createApplicationMgr()
270 
271  self.log.debug('basicInit: apply options')
272 
273  # set ApplicationMgr properties
274  comp = 'ApplicationMgr'
275  props = Configurable.allConfigurables.get(comp, {})
276  if props:
277  props = expandvars(props.getValuedProperties())
278  for p, v in props.items() + [('JobOptionsType', 'NONE')]:
279  if not self.g.setProperty(p, str(v)):
280  self.log.error('Cannot set property %s.%s to %s', comp, p, v)
281  sys.exit(10)
282  # issue with missing dictionary with ROOT < 6.2.7
283  if _bootstrap.ROOT_VERSION < (6, 2, 7):
284  # we need to load GaudiPython
285  import GaudiPython
286 
287  self.g.configure()
288 
289  # set MessageSvc properties
290  comp = 'MessageSvc'
291  msp = self.g.getService(comp)
292  if not msp:
293  self.log.error('Cannot get service %s', comp)
294  sys.exit(10)
295  props = Configurable.allConfigurables.get(comp, {})
296  if props:
297  props = expandvars(props.getValuedProperties())
298  for p, v in props.items():
299  if not _bootstrap.setProperty(msp, p, str(v)):
300  self.log.error('Cannot set property %s.%s to %s', comp, p, v)
301  sys.exit(10)
302 
303  # feed JobOptionsSvc
304  comp = 'JobOptionsSvc'
305  jos = self.g.getService(comp)
306  if not jos:
307  self.log.error('Cannot get service %s', comp)
308  sys.exit(10)
309  for n in getNeededConfigurables():
310  c = Configurable.allConfigurables[n]
311  if n in ['ApplicationMgr','MessageSvc']:
312  continue # These are already done
313  for p, v in c.getValuedProperties().items() :
314  v = expandvars(v)
315  # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference
316  if hasattr(Configurable,"PropertyReference") and type(v) == Configurable.PropertyReference:
317  # this is done in "getFullName", but the exception is ignored,
318  # so we do it again to get it
319  v = v.__resolve__()
320  if type(v) == str : v = '"%s"' % v # need double quotes
321  elif type(v) == long: v = '%d' % v # prevent pending 'L'
322  _bootstrap.addPropertyToCatalogue(jos, n, p, str(v))
323  if hasattr(Configurable,"_configurationLocked"):
324  Configurable._configurationLocked = True
325  self.log.debug('basicInit: done')
326 
def basicInit(self)
Definition: Main.py:252
string type
Definition: gaudirun.py:151
def Gaudi.Main.gaudimain.basicInit (   self)
Bootstrap the application with minimal use of Python bindings.

Definition at line 252 of file Main.py.

252  def basicInit(self):
253  '''
254  Bootstrap the application with minimal use of Python bindings.
255  '''
256  try:
257  from GaudiKernel.Proxy.Configurable import expandvars
258  except ImportError:
259  # pass-through implementation if expandvars is not defined (AthenaCommon)
260  expandvars = lambda data : data
261 
262  from GaudiKernel.Proxy.Configurable import Configurable, getNeededConfigurables
263 
264  global _bootstrap
265  if _bootstrap is None:
266  _bootstrap = BootstrapHelper()
267 
268  self.log.debug('basicInit: instantiate ApplicationMgr')
269  self.ip = self.g = _bootstrap.createApplicationMgr()
270 
271  self.log.debug('basicInit: apply options')
272 
273  # set ApplicationMgr properties
274  comp = 'ApplicationMgr'
275  props = Configurable.allConfigurables.get(comp, {})
276  if props:
277  props = expandvars(props.getValuedProperties())
278  for p, v in props.items() + [('JobOptionsType', 'NONE')]:
279  if not self.g.setProperty(p, str(v)):
280  self.log.error('Cannot set property %s.%s to %s', comp, p, v)
281  sys.exit(10)
282  # issue with missing dictionary with ROOT < 6.2.7
283  if _bootstrap.ROOT_VERSION < (6, 2, 7):
284  # we need to load GaudiPython
285  import GaudiPython
286 
287  self.g.configure()
288 
289  # set MessageSvc properties
290  comp = 'MessageSvc'
291  msp = self.g.getService(comp)
292  if not msp:
293  self.log.error('Cannot get service %s', comp)
294  sys.exit(10)
295  props = Configurable.allConfigurables.get(comp, {})
296  if props:
297  props = expandvars(props.getValuedProperties())
298  for p, v in props.items():
299  if not _bootstrap.setProperty(msp, p, str(v)):
300  self.log.error('Cannot set property %s.%s to %s', comp, p, v)
301  sys.exit(10)
302 
303  # feed JobOptionsSvc
304  comp = 'JobOptionsSvc'
305  jos = self.g.getService(comp)
306  if not jos:
307  self.log.error('Cannot get service %s', comp)
308  sys.exit(10)
309  for n in getNeededConfigurables():
310  c = Configurable.allConfigurables[n]
311  if n in ['ApplicationMgr','MessageSvc']:
312  continue # These are already done
313  for p, v in c.getValuedProperties().items() :
314  v = expandvars(v)
315  # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference
316  if hasattr(Configurable,"PropertyReference") and type(v) == Configurable.PropertyReference:
317  # this is done in "getFullName", but the exception is ignored,
318  # so we do it again to get it
319  v = v.__resolve__()
320  if type(v) == str : v = '"%s"' % v # need double quotes
321  elif type(v) == long: v = '%d' % v # prevent pending 'L'
322  _bootstrap.addPropertyToCatalogue(jos, n, p, str(v))
323  if hasattr(Configurable,"_configurationLocked"):
324  Configurable._configurationLocked = True
325  self.log.debug('basicInit: done')
326 
def basicInit(self)
Definition: Main.py:252
string type
Definition: gaudirun.py:151
def Gaudi.Main.gaudimain.gaudiPythonInit (   self)
Initialize the application with full Python bindings.

Definition at line 327 of file Main.py.

327  def gaudiPythonInit(self):
328  '''
329  Initialize the application with full Python bindings.
330  '''
331  self.log.debug('gaudiPythonInit: import GaudiPython')
332  import GaudiPython
333  self.log.debug('gaudiPythonInit: instantiate ApplicationMgr')
334  self.g = GaudiPython.AppMgr()
335  self.ip = self.g._ip
336  self.log.debug('gaudiPythonInit: done')
337 
def gaudiPythonInit(self)
Definition: Main.py:327
def Gaudi.Main.gaudimain.gaudiPythonInit (   self)
Initialize the application with full Python bindings.

Definition at line 327 of file Main.py.

327  def gaudiPythonInit(self):
328  '''
329  Initialize the application with full Python bindings.
330  '''
331  self.log.debug('gaudiPythonInit: import GaudiPython')
332  import GaudiPython
333  self.log.debug('gaudiPythonInit: instantiate ApplicationMgr')
334  self.g = GaudiPython.AppMgr()
335  self.ip = self.g._ip
336  self.log.debug('gaudiPythonInit: done')
337 
def gaudiPythonInit(self)
Definition: Main.py:327
def Gaudi.Main.gaudimain.generateOptsOutput (   self,
  all = False 
)

Definition at line 192 of file Main.py.

192  def generateOptsOutput(self, all = False):
193  from pprint import pformat
194  conf_dict = Configuration.configurationDict(all)
195  out = []
196  names = conf_dict.keys()
197  names.sort()
198  for n in names:
199  props = conf_dict[n].keys()
200  props.sort()
201  for p in props:
202  out.append('%s.%s = %s;' % (n,p, toOpt(conf_dict[n][p])))
203  return "\n".join(out)
204 
def toOpt(value)
Definition: Main.py:117
def generateOptsOutput
Definition: Main.py:192
def Gaudi.Main.gaudimain.generateOptsOutput (   self,
  all = False 
)

Definition at line 192 of file Main.py.

192  def generateOptsOutput(self, all = False):
193  from pprint import pformat
194  conf_dict = Configuration.configurationDict(all)
195  out = []
196  names = conf_dict.keys()
197  names.sort()
198  for n in names:
199  props = conf_dict[n].keys()
200  props.sort()
201  for p in props:
202  out.append('%s.%s = %s;' % (n,p, toOpt(conf_dict[n][p])))
203  return "\n".join(out)
204 
def toOpt(value)
Definition: Main.py:117
def generateOptsOutput
Definition: Main.py:192
def Gaudi.Main.gaudimain.generatePyOutput (   self,
  all = False 
)

Definition at line 187 of file Main.py.

187  def generatePyOutput(self, all = False):
188  from pprint import pformat
189  conf_dict = Configuration.configurationDict(all)
190  return pformat(conf_dict)
191 
def generatePyOutput
Definition: Main.py:187
def Gaudi.Main.gaudimain.generatePyOutput (   self,
  all = False 
)

Definition at line 187 of file Main.py.

187  def generatePyOutput(self, all = False):
188  from pprint import pformat
189  conf_dict = Configuration.configurationDict(all)
190  return pformat(conf_dict)
191 
def generatePyOutput
Definition: Main.py:187
def Gaudi.Main.gaudimain.printconfig (   self,
  old_format = False,
  all = False 
)

Definition at line 217 of file Main.py.

217  def printconfig(self, old_format = False, all = False) :
218  msg = 'Dumping all configurables and properties'
219  if not all:
220  msg += ' (different from default)'
221  log.info(msg)
222  conf_dict = Configuration.configurationDict(all)
223  if old_format:
224  print self.generateOptsOutput(all)
225  else:
226  print self.generatePyOutput(all)
227 
def generateOptsOutput
Definition: Main.py:192
def generatePyOutput
Definition: Main.py:187
def Gaudi.Main.gaudimain.printconfig (   self,
  old_format = False,
  all = False 
)

Definition at line 217 of file Main.py.

217  def printconfig(self, old_format = False, all = False) :
218  msg = 'Dumping all configurables and properties'
219  if not all:
220  msg += ' (different from default)'
221  log.info(msg)
222  conf_dict = Configuration.configurationDict(all)
223  if old_format:
224  print self.generateOptsOutput(all)
225  else:
226  print self.generatePyOutput(all)
227 
def generateOptsOutput
Definition: Main.py:192
def generatePyOutput
Definition: Main.py:187
def Gaudi.Main.gaudimain.run (   self,
  ncpus = None 
)

Instantiate and run the application.

Depending on the number of CPUs (ncpus) specified, it start

Definition at line 243 of file Main.py.

243  def run(self, ncpus = None):
244  if not ncpus:
245  # Standard sequential mode
246  result = self.runSerial()
247  else:
248  # Otherwise, run with the specified number of cpus
249  result = self.runParallel(ncpus)
250  return result
251 
def runSerial(self)
Definition: Main.py:338
def runParallel(self, ncpus)
Definition: Main.py:404
def run
Instantiate and run the application.
Definition: Main.py:243
def Gaudi.Main.gaudimain.run (   self,
  ncpus = None 
)

Instantiate and run the application.

Depending on the number of CPUs (ncpus) specified, it start

Definition at line 243 of file Main.py.

243  def run(self, ncpus = None):
244  if not ncpus:
245  # Standard sequential mode
246  result = self.runSerial()
247  else:
248  # Otherwise, run with the specified number of cpus
249  result = self.runParallel(ncpus)
250  return result
251 
def runSerial(self)
Definition: Main.py:338
def runParallel(self, ncpus)
Definition: Main.py:404
def run
Instantiate and run the application.
Definition: Main.py:243
def Gaudi.Main.gaudimain.runParallel (   self,
  ncpus 
)

Definition at line 404 of file Main.py.

404  def runParallel(self, ncpus) :
405  if self.mainLoop:
406  self.log.fatal("Cannot use custom main loop in multi-process mode, check your options")
407  return 1
408  self.setupParallelLogging( )
409  from Gaudi.Configuration import Configurable
410  import GaudiMP.GMPBase as gpp
411  c = Configurable.allConfigurables
412  self.log.info('-'*80)
413  self.log.info('%s: Parallel Mode : %i '%(__name__, ncpus))
414  from commands import getstatusoutput as gso
415  metadataCommands = [ 'uname -a',
416  'echo $CMTCONFIG',
417  'echo $GAUDIAPPNAME',
418  'echo $GAUDIAPPVERSION']
419  for comm in metadataCommands :
420  s, o = gso( comm )
421  if s :
422  o = "Undetermined"
423  string = '%s: %30s : %s '%(__name__, comm, o)
424  self.log.info( string )
425  try :
426  events = str(c['ApplicationMgr'].EvtMax)
427  except :
428  events = "Undetermined"
429  self.log.info('%s: Events Specified : %s '%(__name__,events))
430  self.log.info('-'*80)
431  # Parall = gpp.Coordinator(ncpus, shared, c, self.log)
432  Parall = gpp.Coord( ncpus, c, self.log )
433  sysStart = time()
434  sc = Parall.Go()
435  self.log.info('MAIN.PY : received %s from Coordinator'%(sc))
436  if sc.isFailure() :
437  return 1
438  sysTime = time()-sysStart
439  self.log.name = 'Gaudi/Main.py Logger'
440  self.log.info('-'*80)
441  self.log.info('%s: parallel system finished, time taken: %5.4fs', __name__, sysTime)
442  self.log.info('-'*80)
443  return 0
def Gaudi.Main.gaudimain.runParallel (   self,
  ncpus 
)

Definition at line 404 of file Main.py.

404  def runParallel(self, ncpus) :
405  if self.mainLoop:
406  self.log.fatal("Cannot use custom main loop in multi-process mode, check your options")
407  return 1
408  self.setupParallelLogging( )
409  from Gaudi.Configuration import Configurable
410  import GaudiMP.GMPBase as gpp
411  c = Configurable.allConfigurables
412  self.log.info('-'*80)
413  self.log.info('%s: Parallel Mode : %i '%(__name__, ncpus))
414  from commands import getstatusoutput as gso
415  metadataCommands = [ 'uname -a',
416  'echo $CMTCONFIG',
417  'echo $GAUDIAPPNAME',
418  'echo $GAUDIAPPVERSION']
419  for comm in metadataCommands :
420  s, o = gso( comm )
421  if s :
422  o = "Undetermined"
423  string = '%s: %30s : %s '%(__name__, comm, o)
424  self.log.info( string )
425  try :
426  events = str(c['ApplicationMgr'].EvtMax)
427  except :
428  events = "Undetermined"
429  self.log.info('%s: Events Specified : %s '%(__name__,events))
430  self.log.info('-'*80)
431  # Parall = gpp.Coordinator(ncpus, shared, c, self.log)
432  Parall = gpp.Coord( ncpus, c, self.log )
433  sysStart = time()
434  sc = Parall.Go()
435  self.log.info('MAIN.PY : received %s from Coordinator'%(sc))
436  if sc.isFailure() :
437  return 1
438  sysTime = time()-sysStart
439  self.log.name = 'Gaudi/Main.py Logger'
440  self.log.info('-'*80)
441  self.log.info('%s: parallel system finished, time taken: %5.4fs', __name__, sysTime)
442  self.log.info('-'*80)
443  return 0
def Gaudi.Main.gaudimain.runSerial (   self)

Definition at line 338 of file Main.py.

338  def runSerial(self) :
339  #--- Instantiate the ApplicationMgr------------------------------
340  if (self.mainLoop or
341  os.environ.get('GAUDIRUN_USE_GAUDIPYTHON')):
342  self.gaudiPythonInit()
343  else:
344  self.basicInit()
345 
346  self.log.debug('-'*80)
347  self.log.debug('%s: running in serial mode', __name__)
348  self.log.debug('-'*80)
349  sysStart = time()
350 
351  if self.mainLoop:
352  runner = self.mainLoop
353  else:
354  def runner(app, nevt):
355  self.log.debug('initialize')
356  sc = app.initialize()
357  if sc.isSuccess():
358  if self.printsequence:
359  app.printAlgsSequences()
360  self.log.debug('start')
361  sc = app.start()
362  if sc.isSuccess():
363  self.log.debug('run(%d)', nevt)
364  sc = app.run(nevt)
365  self.log.debug('stop')
366  app.stop().ignore()
367  self.log.debug('finalize')
368  app.finalize().ignore()
369  self.log.debug('terminate')
370  sc1 = app.terminate()
371  if sc.isSuccess():
372  sc = sc1
373  else:
374  sc1.ignore()
375  self.log.debug('status code: %s',
376  'SUCCESS' if sc.isSuccess() else 'FAILURE')
377  return sc
378 
379  try:
380  statuscode = runner(self.g, int(self.ip.getProperty('EvtMax').toString()))
381  except SystemError:
382  # It may not be 100% correct, but usually it means a segfault in C++
383  self.ip.setProperty('ReturnCode', str(128 + 11))
384  statuscode = False
385  except Exception, x:
386  print 'Exception:', x
387  # for other exceptions, just set a generic error code
388  self.ip.setProperty('ReturnCode', '1')
389  statuscode = False
390  if hasattr(statuscode, "isSuccess"):
391  success = statuscode.isSuccess()
392  else:
393  success = statuscode
394  #success = self.g.exit().isSuccess() and success
395  if not success and self.ip.getProperty('ReturnCode').toString() == '0':
396  # ensure that the return code is correctly set
397  self.ip.setProperty('ReturnCode', '1')
398  sysTime = time()-sysStart
399  self.log.debug('-'*80)
400  self.log.debug('%s: serial system finished, time taken: %5.4fs', __name__, sysTime)
401  self.log.debug('-'*80)
402  return int(self.ip.getProperty('ReturnCode').toString())
403 
def basicInit(self)
Definition: Main.py:252
def gaudiPythonInit(self)
Definition: Main.py:327
def runSerial(self)
Definition: Main.py:338
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:403
def Gaudi.Main.gaudimain.runSerial (   self)

Definition at line 338 of file Main.py.

338  def runSerial(self) :
339  #--- Instantiate the ApplicationMgr------------------------------
340  if (self.mainLoop or
341  os.environ.get('GAUDIRUN_USE_GAUDIPYTHON')):
342  self.gaudiPythonInit()
343  else:
344  self.basicInit()
345 
346  self.log.debug('-'*80)
347  self.log.debug('%s: running in serial mode', __name__)
348  self.log.debug('-'*80)
349  sysStart = time()
350 
351  if self.mainLoop:
352  runner = self.mainLoop
353  else:
354  def runner(app, nevt):
355  self.log.debug('initialize')
356  sc = app.initialize()
357  if sc.isSuccess():
358  if self.printsequence:
359  app.printAlgsSequences()
360  self.log.debug('start')
361  sc = app.start()
362  if sc.isSuccess():
363  self.log.debug('run(%d)', nevt)
364  sc = app.run(nevt)
365  self.log.debug('stop')
366  app.stop().ignore()
367  self.log.debug('finalize')
368  app.finalize().ignore()
369  self.log.debug('terminate')
370  sc1 = app.terminate()
371  if sc.isSuccess():
372  sc = sc1
373  else:
374  sc1.ignore()
375  self.log.debug('status code: %s',
376  'SUCCESS' if sc.isSuccess() else 'FAILURE')
377  return sc
378 
379  try:
380  statuscode = runner(self.g, int(self.ip.getProperty('EvtMax').toString()))
381  except SystemError:
382  # It may not be 100% correct, but usually it means a segfault in C++
383  self.ip.setProperty('ReturnCode', str(128 + 11))
384  statuscode = False
385  except Exception, x:
386  print 'Exception:', x
387  # for other exceptions, just set a generic error code
388  self.ip.setProperty('ReturnCode', '1')
389  statuscode = False
390  if hasattr(statuscode, "isSuccess"):
391  success = statuscode.isSuccess()
392  else:
393  success = statuscode
394  #success = self.g.exit().isSuccess() and success
395  if not success and self.ip.getProperty('ReturnCode').toString() == '0':
396  # ensure that the return code is correctly set
397  self.ip.setProperty('ReturnCode', '1')
398  sysTime = time()-sysStart
399  self.log.debug('-'*80)
400  self.log.debug('%s: serial system finished, time taken: %5.4fs', __name__, sysTime)
401  self.log.debug('-'*80)
402  return int(self.ip.getProperty('ReturnCode').toString())
403 
def basicInit(self)
Definition: Main.py:252
def gaudiPythonInit(self)
Definition: Main.py:327
def runSerial(self)
Definition: Main.py:338
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:403
def Gaudi.Main.gaudimain.setupParallelLogging (   self)

Definition at line 153 of file Main.py.

153  def setupParallelLogging( self ) :
154  # ---------------------------------------------------
155  # set up Logging
156  # ----------------
157  # from multiprocessing import enableLogging, getLogger
158  import multiprocessing
159  # preliminaries for handlers/output files, etc.
160  from time import ctime
161  datetime = ctime()
162  datetime = datetime.replace(' ', '_')
163  outfile = open( 'gaudirun-%s.log'%(datetime), 'w' )
164  # two handlers, one for a log file, one for terminal
165  streamhandler = logging.StreamHandler(strm=outfile)
166  console = logging.StreamHandler()
167  # create formatter : the params in parentheses are variable names available via logging
168  formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s" )
169  # add formatter to Handler
170  streamhandler.setFormatter(formatter)
171  console.setFormatter(formatter)
172  # now, configure the logger
173  # enableLogging( level=0 )
174  # self.log = getLogger()
175  self.log = multiprocessing.log_to_stderr()
176  self.log.setLevel( logging.INFO )
177  self.log.name = 'Gaudi/Main.py Logger'
178  self.log.handlers = []
179  # add handlers to logger : one for output to a file, one for console output
180  self.log.addHandler(streamhandler)
181  self.log.addHandler(console)
182  self.log.removeHandler(console)
183  # set level!!
184  self.log.setLevel = logging.INFO
185  # ---------------------------------------------------
186 
def setupParallelLogging(self)
Definition: Main.py:153
def Gaudi.Main.gaudimain.setupParallelLogging (   self)

Definition at line 153 of file Main.py.

153  def setupParallelLogging( self ) :
154  # ---------------------------------------------------
155  # set up Logging
156  # ----------------
157  # from multiprocessing import enableLogging, getLogger
158  import multiprocessing
159  # preliminaries for handlers/output files, etc.
160  from time import ctime
161  datetime = ctime()
162  datetime = datetime.replace(' ', '_')
163  outfile = open( 'gaudirun-%s.log'%(datetime), 'w' )
164  # two handlers, one for a log file, one for terminal
165  streamhandler = logging.StreamHandler(strm=outfile)
166  console = logging.StreamHandler()
167  # create formatter : the params in parentheses are variable names available via logging
168  formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s" )
169  # add formatter to Handler
170  streamhandler.setFormatter(formatter)
171  console.setFormatter(formatter)
172  # now, configure the logger
173  # enableLogging( level=0 )
174  # self.log = getLogger()
175  self.log = multiprocessing.log_to_stderr()
176  self.log.setLevel( logging.INFO )
177  self.log.name = 'Gaudi/Main.py Logger'
178  self.log.handlers = []
179  # add handlers to logger : one for output to a file, one for console output
180  self.log.addHandler(streamhandler)
181  self.log.addHandler(console)
182  self.log.removeHandler(console)
183  # set level!!
184  self.log.setLevel = logging.INFO
185  # ---------------------------------------------------
186 
def setupParallelLogging(self)
Definition: Main.py:153
def Gaudi.Main.gaudimain.writeconfig (   self,
  filename,
  all = False 
)

Definition at line 228 of file Main.py.

228  def writeconfig(self, filename, all = False):
229  write = { ".pkl" : lambda filename, all: self._writepickle(filename),
230  ".py" : lambda filename, all: open(filename,"w").write(self.generatePyOutput(all) + "\n"),
231  ".opts": lambda filename, all: open(filename,"w").write(self.generateOptsOutput(all) + "\n"),
232  }
233  from os.path import splitext
234  ext = splitext(filename)[1]
235  if ext in write:
236  write[ext](filename, all)
237  else:
238  log.error("Unknown file type '%s'. Must be any of %r.", ext, write.keys())
239  sys.exit(1)
240 
def _writepickle(self, filename)
Definition: Main.py:205
def generateOptsOutput
Definition: Main.py:192
def generatePyOutput
Definition: Main.py:187
def Gaudi.Main.gaudimain.writeconfig (   self,
  filename,
  all = False 
)

Definition at line 228 of file Main.py.

228  def writeconfig(self, filename, all = False):
229  write = { ".pkl" : lambda filename, all: self._writepickle(filename),
230  ".py" : lambda filename, all: open(filename,"w").write(self.generatePyOutput(all) + "\n"),
231  ".opts": lambda filename, all: open(filename,"w").write(self.generateOptsOutput(all) + "\n"),
232  }
233  from os.path import splitext
234  ext = splitext(filename)[1]
235  if ext in write:
236  write[ext](filename, all)
237  else:
238  log.error("Unknown file type '%s'. Must be any of %r.", ext, write.keys())
239  sys.exit(1)
240 
def _writepickle(self, filename)
Definition: Main.py:205
def generateOptsOutput
Definition: Main.py:192
def generatePyOutput
Definition: Main.py:187

Member Data Documentation

Gaudi.Main.gaudimain.g

Definition at line 269 of file Main.py.

Gaudi.Main.gaudimain.ip

Definition at line 269 of file Main.py.

Gaudi.Main.gaudimain.log

Definition at line 150 of file Main.py.

Gaudi.Main.gaudimain.mainLoop = None
static

Definition at line 141 of file Main.py.

Gaudi.Main.gaudimain.printsequence

Definition at line 151 of file Main.py.


The documentation for this class was generated from the following file:
  • InstallArea/x86_64-slc6-gcc48-opt/python/Gaudi/Main.py