390 def setup( self, recursive = False ):
391 if not recursive
and (self._opts
and (self._opts.drop_reload
or self._opts.config_only)):
393 if self._opts.config_only
is True:
395 elif self._opts.config_only:
396 fn = self._opts.config_only
398 fn =
'TempAthenaConfig.' +
str(os.getpid()) +
'.pkl'
401 Logging.log.info(
"storing configuration in %s", fn )
402 from AthenaCommon
import ConfigurationShelve
403 ConfigurationShelve.storeJobOptionsCatalogue( fn )
404 del ConfigurationShelve
406 if self._opts.drop_reload:
409 del sys.argv[ sys.argv.index(
'--drop-and-reload' ) ]
410 for arg
in sys.argv[1:]:
411 if arg[-3:] ==
'.py':
412 del sys.argv[ sys.argv.index( arg ) ]
415 idx = sys.argv.index( arg )
416 del sys.argv[ idx : idx + 2 ]
419 if self._opts.profile_python:
420 i = sys.argv.index(
'--profile-python' )
422 from AthenaCommon.Debugging
import dumpPythonProfile
426 Logging.log.info(
'restarting athena.py from %s ... ', fn )
427 sys.argv.insert( 1, fn )
428 os.execvp( sys.argv[0], sys.argv )
432 if self._opts.profile_python:
433 from AthenaCommon.Debugging
import dumpPythonProfile
435 Logging.log.info(
"configuration complete, now exiting ... " )
436 os._exit( self._exitstate )
441 handle = self.getHandle()
444 handle.__dict__[
'CreateSvc'] = self.__dict__.
get(
'CreateSvc',
447 from GaudiPython
import AppMgr
as GaudiAppMgr
457 if hasattr(atexit,
'_exithandlers'):
458 for handler
in atexit._exithandlers[:]:
459 if hasattr(handler[0],
'__module__')
and handler[0].__module__:
460 if 'audiPython' in handler[0].__module__:
462 atexit._exithandlers.remove( handler )
465 def _setattr( self, n, v ):
471 return super( GaudiAppMgr, self ).
__setattr__( n, v )
472 GaudiAppMgr_old_setattr = GaudiAppMgr.__setattr__
473 GaudiAppMgr.__setattr__ = _setattr
476 def _getattr( self, n ):
478 return self.__dict__[n]
479 return super( GaudiAppMgr, self ).__getattr__( n )
480 GaudiAppMgr_old_getattr = GaudiAppMgr.__getattr__
481 GaudiAppMgr.__getattr__ = _getattr
486 self.toolSvc().
setup()
489 self.serviceMgr().
setup()
492 master_seq = self.__build_master_sequence()
496 handle.TopAlg = [ master_seq.getFullName() ]
499 streams = self.__dict__[
'_streams' ]
501 handle.OutStream =
list(map(
lambda x: x.getFullName(), streams.getChildren() ))
505 super(AppMgr,self).
__setattr__(
'Dlls', handle.Dlls)
508 svcMgr = self.serviceMgr()
509 _createSvc = handle.__dict__[
'CreateSvc']
510 if len(_createSvc) > 0
and \
511 _createSvc[0] != svcMgr.ToolSvc.getFullName():
512 _createSvc = [ svcMgr.ToolSvc.getFullName() ] + _createSvc
514 if 'CreateSvc' in self.__dict__:
515 del self.__dict__[
'CreateSvc']
516 handle.__dict__[
'CreateSvc'] = [ s
for s
in _createSvc ]
519 del handle.__dict__[
'CreateSvc']
520 GaudiAppMgr.__getattr__ = GaudiAppMgr_old_getattr
521 GaudiAppMgr.__setattr__ = GaudiAppMgr_old_setattr
524 Logging.log.debug(
'Updating (C++) "CreateSvc" property...' )
525 handle.CreateSvc = _createSvc
526 Logging.log.debug(
'Updating (C++) "CreateSvc" property... [ok]' )
529 if self._opts
and self._opts.config_dump_file:
530 import AthenaCommon.ConfigurationShelve
as cs
531 cs.saveToAscii(self._opts.config_dump_file)