def executeAlgorithms(self):
        try:
            import GaudiPython.Bindings as PyGaudi
        except AttributeError:
            import GaudiPython as PyGaudi
        except ImportError:
            import gaudimodule as PyGaudi
        from AthenaCommon.AppMgr import theApp

        result = PyGaudi.SUCCESS

        try:
            for name in theApp.TopAlg:
                alg = theApp.algorithm(name[name.find('/') + 1:])
                if not alg._ialg:
                    alg.retrieveInterface()
                ialg = alg._ialg
                ialg.resetExecuted()
                result = ialg.sysExecute()
                if result.isFailure():
                    from AthenaCommon.Logging import log as msg
                    msg.error("Execution of algorithm %s failed" % name)
                    return result.getCode()
        except KeyboardInterrupt:
            from AthenaCommon.Logging import log as msg
            msg.critical("event loop stopped by user interrupt")
            return PyGaudi.FAILURE.getCode()

        return result.getCode()
Пример #2
0
def _process_cmdline_args():
    import AthenaCommon.AthOptionsParser as aop

    opts = aop.parse(chk_tcmalloc=False)

    #-----------------------------------------------------------------
    # side-effect: bootstrap ourselves and handle the environment
    # changing options (tcmalloc/stdcmalloc -> LD_PRELOAD)
    # => we may need to os.execvpe ourselves with the correct new env.
    _frozen = os.environ.get('_ATHENA_APP_FROZEN', '0')
    os.environ['_ATHENA_APP_FROZEN'] = _frozen
    # may not return !
    _bootstrap_env(opts)
    #-----------------------------------------------------------------
    
    from AthenaCommon.Logging import log as msg
    from AthenaCommon.Logging import logging
    msg.setLevel(getattr(logging, opts.msg_lvl))
    
    import AthenaCommon.ExitCodes as ExitCodes
    
    if len(opts.scripts)<=0 and opts.run_batch:
        msg.error("batch mode requires at least one joboptions")
        raise aop.AthOptionsError(reason=ExitCodes.INCLUDE_ERROR)

    return opts
Пример #3
0
def _process_cmdline_args():
    import AthenaCommon.AthOptionsParser as aop

    opts = aop.parse(chk_tcmalloc=False)

    #-----------------------------------------------------------------
    # side-effect: bootstrap ourselves and handle the environment
    # changing options (tcmalloc/stdcmalloc -> LD_PRELOAD)
    # => we may need to os.execvpe ourselves with the correct new env.
    _frozen = os.environ.get('_ATHENA_APP_FROZEN', '0')
    os.environ['_ATHENA_APP_FROZEN'] = _frozen
    # may not return !
    _bootstrap_env(opts)
    #-----------------------------------------------------------------

    from AthenaCommon.Logging import log as msg
    from AthenaCommon.Logging import logging
    msg.setLevel(getattr(logging, opts.msg_lvl))

    import AthenaCommon.ExitCodes as ExitCodes

    if len(opts.scripts) <= 0 and opts.run_batch:
        msg.error("batch mode requires at least one joboptions")
        raise aop.AthOptionsError(reason=ExitCodes.INCLUDE_ERROR)

    return opts
Пример #4
0
   def executeAlgorithms( self ):
      try:                   import GaudiPython.Bindings as PyGaudi
      except AttributeError: import GaudiPython          as PyGaudi
      except ImportError:    import gaudimodule          as PyGaudi
      from AthenaCommon.AppMgr import theApp

      result = PyGaudi.SUCCESS

      try:
         for name in theApp.TopAlg:
            alg = theApp.algorithm( name[ name.find('/')+1 : ] )
            if not alg._ialg:
               alg.retrieveInterface()
            ialg = alg._ialg
            ialg.resetExecuted()
            result = ialg.sysExecute()
            if result.isFailure():
               from AthenaCommon.Logging import log as msg
               msg.error( "Execution of algorithm %s failed" % name )
               return result.getCode()
      except KeyboardInterrupt:
         from AthenaCommon.Logging import log as msg
         msg.critical( "event loop stopped by user interrupt" )
         return PyGaudi.FAILURE.getCode()

      return result.getCode()
Пример #5
0
def setupCommonServicesEnd():
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.Logging import logging
    from AthenaCommon.AlgSequence import AlgSequence

    log = logging.getLogger(
        'TriggerUnixStandardSetup::setupCommonServicesEnd:')
    topSequence = AlgSequence()

    # --- create the ByteStreamCnvSvc after the Detector Description otherwise
    # --- the initialization of converters fails
    #from AthenaCommon.AppMgr import theApp
    #theApp.CreateSvc += [ svcMgr.ByteStreamCnvSvc.getFullName() ]

    # Make sure no THistSvc output/input stream is defined for online running
    if _Conf.useOnlineTHistSvc:
        svcMgr.THistSvc.Output = []
        if len(svcMgr.THistSvc.Input) > 0:
            log.error(
                'THistSvc.Input = %s. Input not allowed for online running. Disabling input.',
                svcMgr.THistSvc.Input)
            svcMgr.THistSvc.Input = []

    # For offline running make sure at least the EXPERT stream is defined
    else:
        if 1 not in [o.count('EXPERT') for o in svcMgr.THistSvc.Output]:
            svcMgr.THistSvc.Output += [
                "EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'"
            ]

    # Basic operational monitoring
    from TrigOnlineMonitor.TrigOnlineMonitorConfig import TrigOpMonitor
    topSequence += TrigOpMonitor()

    # Set default properties for some important services after all user job options
    log.info('Configure core services for online running')

    svcMgr.CoreDumpSvc.CoreDumpStream = "stdout"
    svcMgr.CoreDumpSvc.CallOldHandler = False
    svcMgr.CoreDumpSvc.StackTrace = True
    svcMgr.CoreDumpSvc.FatalHandler = 0  # no extra fatal handler
    svcMgr.CoreDumpSvc.TimeOut = 60000000000  # timeout for stack trace generation changed to 60s (ATR-17112)

    svcMgr.IOVSvc.updateInterval = "RUN"
    svcMgr.IOVSvc.preLoadData = True
    svcMgr.IOVSvc.preLoadExtensibleFolders = False  # ATR-19392
    svcMgr.IOVSvc.forceResetAtBeginRun = False

    if hasattr(svcMgr, 'IOVDbSvc'):
        svcMgr.IOVDbSvc.CacheAlign = 0  # VERY IMPORTANT to get unique queries for folder udpates (see Savannah #81092)
        svcMgr.IOVDbSvc.CacheRun = 0
        svcMgr.IOVDbSvc.CacheTime = 0

    return
Пример #6
0
def _setupCommonServicesEnd():
    from AthenaCommon.AppMgr import theApp
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr    
    from AthenaCommon.Logging import logging
    from TriggerJobOpts.TriggerFlags import TriggerFlags
    
    log = logging.getLogger( 'TriggerUnixStandardSetup::setupCommonServicesEnd:' )
    
    # --- create the ByteStreamCnvSvc after the Detector Description otherwise
    # --- the initialization of converters fails
    theApp.CreateSvc += [ svcMgr.ByteStreamCnvSvc.getFullName() ]    

    # Make sure no THistSvc output/input stream is defined for online running
    if _Conf.useOnlineTHistSvc:
        svcMgr.THistSvc.Output = []
        if len(svcMgr.THistSvc.Input)>0:
            log.error('THistSvc.Input = %s. Input not allowed for online running. Disabling input.' % svcMgr.THistSvc.Input)
            svcMgr.THistSvc.Input = []

    # For offline running make sure at least the EXPERT stream is defined
    else:
        if 1 not in [ o.count('EXPERT') for o in svcMgr.THistSvc.Output ]:
            svcMgr.THistSvc.Output += ["EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'"]


    # Set default properties for some important services after all user job options
    log.info('Configure core services for online runnig')

    svcMgr.CoreDumpSvc.CoreDumpStream = "stdout"
    svcMgr.CoreDumpSvc.CallOldHandler = True
    svcMgr.CoreDumpSvc.FatalHandler = 0   # no extra fatal handler
    svcMgr.CoreDumpSvc.TimeOut = 60000000000        # no timeout for stack trace generation -> changed to 60s (ATR17112)

    # Disable StatusCodeSvc (causes problems with shutting down children at stop in HLTPU)
    svcMgr.StatusCodeSvc.SuppressCheck = True
    svcMgr.StatusCodeSvc.AbortOnError = False
        
    svcMgr.IOVSvc.updateInterval = "RUN"
    svcMgr.IOVSvc.preLoadData = True  
    svcMgr.IOVSvc.forceResetAtBeginRun = False 

    if hasattr(svcMgr,'IOVDbSvc'):
        svcMgr.IOVDbSvc.CacheAlign = 0  # VERY IMPORTANT to get unique queries for folder udpates (see Savannah #81092)
        svcMgr.IOVDbSvc.CacheRun = 0
        svcMgr.IOVDbSvc.CacheTime = 0
        
    # Flag to extract trigger configuration
    if TriggerFlags.Online.doDBConfig():
        from TrigConfigSvc import DoDBConfig
        
    # --- print out configuration details
    _printConfiguration(log.name)
    
    return