391 def setup( self, recursive = False ):
392 if not recursive
and (self._opts
and (self._opts.drop_reload
or self._opts.config_only)):
394 if self._opts.config_only
is True:
396 elif self._opts.config_only:
397 fn = self._opts.config_only
399 fn =
'TempAthenaConfig.' +
str(os.getpid()) +
'.pkl'
402 Logging.log.info(
"storing configuration in %s", fn )
403 from AthenaCommon
import ConfigurationShelve
404 ConfigurationShelve.storeJobOptionsCatalogue( fn )
405 del ConfigurationShelve
407 if self._opts.drop_reload:
410 del sys.argv[ sys.argv.index(
'--drop-and-reload' ) ]
411 for arg
in sys.argv[1:]:
412 if arg[-3:] ==
'.py':
413 del sys.argv[ sys.argv.index( arg ) ]
416 idx = sys.argv.index( arg )
417 del sys.argv[ idx : idx + 2 ]
420 if self._opts.profile_python:
421 i = sys.argv.index(
'--profile-python' )
423 from AthenaCommon.Debugging
import dumpPythonProfile
427 Logging.log.info(
'restarting athena.py from %s ... ', fn )
428 sys.argv.insert( 1, fn )
429 os.execvp( sys.argv[0], sys.argv )
433 if self._opts.profile_python:
434 from AthenaCommon.Debugging
import dumpPythonProfile
436 Logging.log.info(
"configuration complete, now exiting ... " )
437 os._exit( self._exitstate )
442 handle = self.getHandle()
445 handle.__dict__[
'CreateSvc'] = self.__dict__.
get(
'CreateSvc',
448 from GaudiPython
import AppMgr
as GaudiAppMgr
458 if hasattr(atexit,
'_exithandlers'):
459 for handler
in atexit._exithandlers[:]:
460 if hasattr(handler[0],
'__module__')
and handler[0].__module__:
461 if 'audiPython' in handler[0].__module__:
463 atexit._exithandlers.remove( handler )
466 def _setattr( self, n, v ):
472 return super( GaudiAppMgr, self ).
__setattr__( n, v )
473 GaudiAppMgr_old_setattr = GaudiAppMgr.__setattr__
474 GaudiAppMgr.__setattr__ = _setattr
477 def _getattr( self, n ):
479 return self.__dict__[n]
480 return super( GaudiAppMgr, self ).__getattr__( n )
481 GaudiAppMgr_old_getattr = GaudiAppMgr.__getattr__
482 GaudiAppMgr.__getattr__ = _getattr
487 self.toolSvc().
setup()
490 self.serviceMgr().
setup()
493 master_seq = self.__build_master_sequence()
497 handle.TopAlg = [ master_seq.getFullName() ]
500 streams = self.__dict__[
'_streams' ]
502 handle.OutStream =
list(map(
lambda x: x.getFullName(), streams.getChildren() ))
506 super(AppMgr,self).
__setattr__(
'Dlls', handle.Dlls)
509 svcMgr = self.serviceMgr()
510 _createSvc = handle.__dict__[
'CreateSvc']
511 if len(_createSvc) > 0
and \
512 _createSvc[0] != svcMgr.ToolSvc.getFullName():
513 _createSvc = [ svcMgr.ToolSvc.getFullName() ] + _createSvc
515 if 'CreateSvc' in self.__dict__:
516 del self.__dict__[
'CreateSvc']
517 handle.__dict__[
'CreateSvc'] = [ s
for s
in _createSvc ]
520 del handle.__dict__[
'CreateSvc']
521 GaudiAppMgr.__getattr__ = GaudiAppMgr_old_getattr
522 GaudiAppMgr.__setattr__ = GaudiAppMgr_old_setattr
525 Logging.log.debug(
'Updating (C++) "CreateSvc" property...' )
526 handle.CreateSvc = _createSvc
527 Logging.log.debug(
'Updating (C++) "CreateSvc" property... [ok]' )
530 if self._opts
and self._opts.config_dump_file:
531 import AthenaCommon.ConfigurationShelve
as cs
532 cs.saveToAscii(self._opts.config_dump_file)