390 def setup( self, recursive = False ):
391 if not recursive
and (self._opts
and (self._opts.drop_reload
or self._opts.config_only)):
395 if self._opts.config_only
is True:
397 elif self._opts.config_only:
398 fn = self._opts.config_only
400 fn =
'TempAthenaConfig.' +
str(os.getpid()) +
'.pkl'
403 Logging.log.info(
"storing configuration in %s", fn )
404 from AthenaCommon
import ConfigurationShelve
405 ConfigurationShelve.storeJobOptionsCatalogue( fn )
406 del ConfigurationShelve
408 if self._opts.drop_reload:
411 del sys.argv[ sys.argv.index(
'--drop-and-reload' ) ]
412 for arg
in sys.argv[1:]:
413 if arg[-3:] ==
'.py':
414 del sys.argv[ sys.argv.index( arg ) ]
417 idx = sys.argv.index( arg )
418 del sys.argv[ idx : idx + 2 ]
421 if self._opts.profile_python:
422 i = sys.argv.index(
'--profile-python' )
424 from AthenaCommon.Debugging
import dumpPythonProfile
428 Logging.log.info(
'restarting athena.py from %s ... ', fn )
429 sys.argv.insert( 1, fn )
430 os.execvp( sys.argv[0], sys.argv )
434 if self._opts.profile_python:
435 from AthenaCommon.Debugging
import dumpPythonProfile
437 Logging.log.info(
"configuration complete, now exiting ... " )
438 os._exit( self._exitstate )
443 handle = self.getHandle()
446 handle.__dict__[
'CreateSvc'] = self.__dict__.
get(
'CreateSvc',
449 from GaudiPython
import AppMgr
as GaudiAppMgr
459 if hasattr(atexit,
'_exithandlers'):
460 for handler
in atexit._exithandlers[:]:
461 if hasattr(handler[0],
'__module__')
and handler[0].__module__:
462 if 'audiPython' in handler[0].__module__:
464 atexit._exithandlers.remove( handler )
467 def _setattr( self, n, v ):
473 return super( GaudiAppMgr, self ).
__setattr__( n, v )
474 GaudiAppMgr_old_setattr = GaudiAppMgr.__setattr__
475 GaudiAppMgr.__setattr__ = _setattr
478 def _getattr( self, n ):
480 return self.__dict__[n]
481 return super( GaudiAppMgr, self ).__getattr__( n )
482 GaudiAppMgr_old_getattr = GaudiAppMgr.__getattr__
483 GaudiAppMgr.__getattr__ = _getattr
488 self.toolSvc().
setup()
491 self.serviceMgr().
setup()
494 master_seq = self.__build_master_sequence()
498 handle.TopAlg = [ master_seq.getFullName() ]
501 streams = self.__dict__[
'_streams' ]
503 handle.OutStream =
list(map(
lambda x: x.getFullName(), streams.getChildren() ))
507 super(AppMgr,self).
__setattr__(
'Dlls', handle.Dlls)
510 svcMgr = self.serviceMgr()
511 _createSvc = handle.__dict__[
'CreateSvc']
512 if len(_createSvc) > 0
and \
513 _createSvc[0] != svcMgr.ToolSvc.getFullName():
514 _createSvc = [ svcMgr.ToolSvc.getFullName() ] + _createSvc
516 if 'CreateSvc' in self.__dict__:
517 del self.__dict__[
'CreateSvc']
518 handle.__dict__[
'CreateSvc'] = [ s
for s
in _createSvc ]
521 del handle.__dict__[
'CreateSvc']
522 GaudiAppMgr.__getattr__ = GaudiAppMgr_old_getattr
523 GaudiAppMgr.__setattr__ = GaudiAppMgr_old_setattr
526 Logging.log.debug(
'Updating (C++) "CreateSvc" property...' )
527 handle.CreateSvc = _createSvc
528 Logging.log.debug(
'Updating (C++) "CreateSvc" property... [ok]' )
531 if self._opts
and self._opts.config_dump_file:
532 import AthenaCommon.ConfigurationShelve
as cs
533 cs.saveToAscii(self._opts.config_dump_file)