Exemplo n.º 1
0
 def root6_importhook(name,
                      globals={},
                      locals={},
                      fromlist=[],
                      level=-1):
     if name == 'PyCintex':
         import sys, traceback
         source, line, f, t = traceback.extract_stack(
             sys._getframe(1))[-1]
         log.warning(
             'PyCintex imported (replace with import cppyy) from: %s:%d'
             % (source, line))
     m = oldimporthook(name, globals, locals, fromlist, level)
     if m and (m.__name__ == 'ROOT' or name[0:4] == 'ROOT'):
         log.debug('Python import module=%s  fromlist=%s' %
                   (name, str(fromlist)))
         if fromlist:
             #MN: in this case 'm' is the final nested module already, don't walk the full 'name'
             vars = [
                 '.'.join(['', fl, autoload_var_name])
                 for fl in fromlist
             ]
         else:
             vars = ['.'.join([name, autoload_var_name])]
         for v in vars:
             try:
                 mm = m
                 #MN: walk the module chain and try to touch 'autoload_var_name' to trigger ROOT autoloading of namespaces
                 for comp in v.split('.')[1:]:
                     mm = getattr(mm, comp)
             except:
                 pass
     return m
Exemplo n.º 2
0
 def mem_status(msg):
     """memory usage information: shared/private"""
     for line in open('/proc/self/status'):
         if line.startswith('Vm'):
             msg.debug(line.strip())
     private, shared = _get_mem_stats()
     msg.info("===> private: %s MB | shared: %s MB", private / 1024.,
              shared / 1024.)
Exemplo n.º 3
0
 def mem_status(msg):
     """memory usage information: shared/private"""
     for line in open('/proc/self/status'):
         if line.startswith('Vm'):
             msg.debug (line.strip())
     private,shared=_get_mem_stats()
     msg.info ("===> private: %s MB | shared: %s MB",
               private/1024.,
               shared /1024.)
Exemplo n.º 4
0
def setupHLTServicesEnd():
    from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR

    from AthenaCommon.Logging import logging
    log = logging.getLogger( 'TriggerUnixStandardSetup::setupHLTServicesEnd:' )
    log.debug( "---> Start" )

    # --- final modifications to standard services
    _setupCommonServicesEnd()      

    log.debug( "---> End" )
    return
Exemplo n.º 5
0
def get_mp_root(msg=""):
    tmp_root=os.getenv("ATHENA_MP_TMPDIR")
    if msg == "":
        from AthenaCommon.Logging import log as msg
    if tmp_root is None:
        import tempfile
        if tempfile.tempdir is None:
            tmp_root = "/tmp"
        else:
            tmp_root = tempfile.tempdir
    else:
        msg.debug("Using ATHENA_MP_TMPDIR environment variable to set athena-mp dir")
    username = "******"    
    if os.getenv("LOGNAME") != None :
        username = os.getenv("LOGNAME")
    elif os.getenv("USER") != None :
        username = os.getenv("USER")
    return  os.sep.join([tmp_root,"athena-mp-tmp-%s" % username])
Exemplo n.º 6
0
def get_mp_root(msg=""):
    tmp_root=os.getenv("ATHENA_MP_TMPDIR")
    if msg == "":
        from AthenaCommon.Logging import log as msg
    if tmp_root is None:
        import tempfile
        if tempfile.tempdir is None:
            tmp_root = "/tmp"
        else:
            tmp_root = tempfile.tempdir
    else:
        msg.debug("Using ATHENA_MP_TMPDIR environment variable to set athena-mp dir")
    username = "******"    
    if os.getenv("LOGNAME") != None :
        username = os.getenv("LOGNAME")
    elif os.getenv("USER") != None :
        username = os.getenv("USER")
    return  os.sep.join([tmp_root,"athena-mp-tmp-%s" % username])
Exemplo n.º 7
0
def watch(msg=None, message=""):
    import time
    """Timer (elap, user, system, child) with time-interval-reports into msg stream"""
    global time_list, time_list2
    time_list.append(os.times())
    time_list2.append(time.time())

    if msg is not None:
        (utime, stime, cutime, cstime, etime) = dt()
        elap_time = "%s_ELAP_TIME=%.4f seconds" % (message, etime)
        user_time = "%s_USER_TIME=%.2f" % (message, utime)
        system_time = "%s_SYSTEM_TIME=%.2f" % (message, stime)
        child_utime = "%s_CHILD_UTIME=%.2f" % (message, cutime)
        child_stime = "%s_CHILD_STIME=%.2f" % (message, cstime)
        msg.info(elap_time)
        msg.debug("%s %s" % (user_time, system_time))
        msg.debug("%s %s" % (child_utime, child_stime))
    return len(time_list)
Exemplo n.º 8
0
def setupHLTServicesBegin():
    from AthenaCommon import CfgMgr
    from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
    from AthenaCommon.AppMgr import theApp
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.Logging import logging
    log = logging.getLogger( 'TriggerUnixStandardSetup::setupHLTServicesBegin:' )
    log.debug( "---> Start" )

    # --- setup the standard services
    _setupCommonServices()   

    # --- Hlt ROBDataProvider configuration
    svcMgr += CfgMgr.HltROBDataProviderSvc("ROBDataProviderSvc")
    theApp.CreateSvc += [ svcMgr.ROBDataProviderSvc.getFullName() ]

    log.debug( "---> End" )
    return
Exemplo n.º 9
0
def watch(msg=None, message=""):
    import time
    """Timer (elap, user, system, child) with time-interval-reports into msg stream"""
    global time_list, time_list2
    time_list.append(os.times())
    time_list2.append(time.time())
    
    if msg is not None:
        (utime, stime, cutime, cstime, etime) = dt();
        elap_time =     "%s_ELAP_TIME=%.4f seconds" % (message, etime)
        user_time =     "%s_USER_TIME=%.2f" %   (message, utime)
        system_time =   "%s_SYSTEM_TIME=%.2f" % (message, stime) 
        child_utime =   "%s_CHILD_UTIME=%.2f" % (message, cutime)
        child_stime =   "%s_CHILD_STIME=%.2f" % (message, cstime)
        msg.info(elap_time)
        msg.debug("%s %s" % (user_time, system_time) )
        msg.debug("%s %s" % (child_utime, child_stime) )
    return len(time_list)
Exemplo n.º 10
0
def setupEvtSelForSeekOps():
    """ try to install seek-stuff on the EventSelector side """
    #import sys
    #from AthenaCommon.Logging import log as msg
    msg.debug("setupEvtSelForSeekOps:")
    if sys.modules.has_key('AthenaRootComps.ReadAthenaRoot'):
        # athenarootcomps has seeking enabled by default
        msg.info('=> Seeking enabled.')
        return

    if not sys.modules.has_key('AthenaPoolCnvSvc.ReadAthenaPool'):
        ## user did not import that module so we give up
        msg.info( "Cannot enable 'seeking' b/c module " + \
                   "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
        msg.info( "Modify your jobOptions to import that module "+ \
                   "(or just ignore this message)" )
        return

    from AthenaCommon.AppMgr import theApp, AthAppMgr
    if theApp.state() != AthAppMgr.State.OFFLINE:
        msg.info( "C++ ApplicationMgr already instantiated, probably seeking "+\
                  "will be ill-configured..." )
        msg.info("EventSelector writers should implement updateHandlers")

    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.Configurable import Configurable
    collectionType = svcMgr.EventSelector.properties()["CollectionType"]

    if collectionType in (
            "ImplicitROOT",
            Configurable.propertyNoValue,
    ):
        svcMgr.EventSelector.CollectionType = "SeekableROOT"
        msg.info("=> Seeking enabled.")

    elif collectionType in ("SeekableROOT", ):
        msg.verbose("=> Seeking already enabled.")

    else:
        msg.warning(
            "Input seeking is not compatible with collection type of %s",
            svcMgr.EventSelector.properties()["CollectionType"])
        msg.warning("=> Seeking disabled.")
    return
Exemplo n.º 11
0
def update_io_registry(wkdir, mpid, iocomp_types=None):
    """helper method to correctly update the IoRegistry instances
    """
    import os
    from os.path import join as _join
    from os.path import basename as _basename
    from os.path import isabs as _isabs

    from PyUtils.PoolFile import PoolFileCatalog

    # ioreg is a dict:
    # {'iocomp-name' : { 'old-fname' : ['iomode', 'new-fname'] }, ... }
    ioreg = IoRegistry.instances
    msg.debug("ioreg::: %s" % ioreg)

    pfc = PoolFileCatalog()

    ioreg_items = IoRegistry.instances.iteritems()
    for iocomp, iodata in ioreg_items:
        #print "--iocomp,len(iodata)",iocomp, len(iodata)
        io_items = iodata.iteritems()
        for ioname, ioval in io_items:
            # handle logical filenames...
            #ioname=pfc(ioname)
            pfc_name = pfc(ioname)
            if (pfc_name != ioname):
                ioreg[iocomp][ioname][1] = pfc_name

            ##print " --iocomp,ioname,ioval",iocomp,ioname,ioval
            iomode, newname = ioval[0], ioval[1] or ioname
            if iomode == '<output>':
                newname = _join(
                    wkdir,
                    "mpid_%s__%s" % (str(mpid).zfill(3), _basename(ioname)))
                msg.debug("update_io_registry:<output>: newname=%s" % newname)
            elif iomode == '<input>':
                if not _isabs(ioname) and not ioname.startswith(
                        "root:") and not ioname.startswith("rfio"):
                    # FIXME: handle URLs/URIs...
                    src = os.path.abspath(_join(os.curdir, ioname))
                    dst = _join(wkdir, ioname)
                    os.symlink(src, dst)
                    msg.debug(
                        "update_io_registry:<input> created symlink %s for" %
                        dst)
            else:
                raise ValueError, "unexpected iomode value: %r" % iomode
            ioreg[iocomp][ioname][1] = newname
            pass
        pass
    msg.debug("IoRegistry.instances=%s" % IoRegistry.instances)
    return  # update_io_registry
Exemplo n.º 12
0
def setupEvtSelForSeekOps():
   """ try to install seek-stuff on the EventSelector side """
   #import sys
   #from AthenaCommon.Logging import log as msg
   msg.debug("setupEvtSelForSeekOps:")
   if sys.modules.has_key('AthenaRootComps.ReadAthenaRoot'):
       # athenarootcomps has seeking enabled by default
       msg.info('=> Seeking enabled.')
       return
   
   if not sys.modules.has_key('AthenaPoolCnvSvc.ReadAthenaPool'):
      ## user did not import that module so we give up
      msg.info( "Cannot enable 'seeking' b/c module " + \
                 "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
      msg.info( "Modify your jobOptions to import that module "+ \
                 "(or just ignore this message)" )
      return

   from AthenaCommon.AppMgr import theApp, AthAppMgr
   if theApp.state() != AthAppMgr.State.OFFLINE:
      msg.info( "C++ ApplicationMgr already instantiated, probably seeking "+\
                "will be ill-configured..." )
      msg.info( "EventSelector writers should implement updateHandlers" )
   
   from AthenaCommon.AppMgr import ServiceMgr as svcMgr
   from AthenaCommon.Configurable import Configurable
   collectionType = svcMgr.EventSelector.properties()["CollectionType"]

   if collectionType in ( "ImplicitROOT", Configurable.propertyNoValue, ):
      svcMgr.EventSelector.CollectionType = "SeekableROOT"
      msg.info   ( "=> Seeking enabled." )

   elif collectionType in ( "SeekableROOT", ):
      msg.verbose( "=> Seeking already enabled." )

   else:
      msg.warning( "Input seeking is not compatible with collection type of %s",
                   svcMgr.EventSelector.properties()["CollectionType"] )
      msg.warning( "=> Seeking disabled." )
   return
Exemplo n.º 13
0
def update_io_registry(wkdir, mpid, iocomp_types=None):
    """helper method to correctly update the IoRegistry instances
    """
    import os
    from os.path import join as _join
    from os.path import basename as _basename
    from os.path import isabs as _isabs

    from PyUtils.PoolFile import PoolFileCatalog
    
    # ioreg is a dict:
    # {'iocomp-name' : { 'old-fname' : ['iomode', 'new-fname'] }, ... }
    ioreg = IoRegistry.instances
    msg.debug("ioreg::: %s" % ioreg)
    
    pfc = PoolFileCatalog()

    ioreg_items = IoRegistry.instances.iteritems()
    for iocomp,iodata in ioreg_items:
        #print "--iocomp,len(iodata)",iocomp, len(iodata)
        io_items = iodata.iteritems()
        for ioname,ioval in io_items:
            # handle logical filenames...
            #ioname=pfc(ioname)
            pfc_name = pfc(ioname)
            if (pfc_name != ioname):
                ioreg[iocomp][ioname][1]=pfc_name
        
            ##print " --iocomp,ioname,ioval",iocomp,ioname,ioval
            iomode,newname = ioval[0], ioval[1] or ioname
            if iomode == '<output>':
                newname = _join (wkdir,
                                 "mpid_%s__%s"%(str(mpid).zfill(3),
                                                _basename(ioname)))
                msg.debug ("update_io_registry:<output>: newname=%s" % newname)
            elif iomode == '<input>':
                if not _isabs(ioname) and not ioname.startswith("root:") and not ioname.startswith("rfio"):
                # FIXME: handle URLs/URIs...
                    src = os.path.abspath(_join(os.curdir, ioname))
                    dst = _join(wkdir, ioname)
                    os.symlink(src, dst)
                    msg.debug( "update_io_registry:<input> created symlink %s for" % dst)
            else:
                raise ValueError, "unexpected iomode value: %r"%iomode
            ioreg[iocomp][ioname][1] = newname
            pass
        pass
    msg.debug( "IoRegistry.instances=%s" % IoRegistry.instances )
    return # update_io_registry
Exemplo n.º 14
0
 def root6_importhook(name, globals={}, locals={}, fromlist=[], level=-1):
     if six.PY3 and level < 0: level = 0
     m = oldimporthook(name, globals, locals, fromlist, level)
     if m and (m.__name__== 'ROOT' or name[0:4]=='ROOT') \
           and (name!='ROOT' or fromlist is not None): # prevent triggering on just 'import ROOT'; see ATEAM-597
         log.debug('Python import module=%s  fromlist=%s', name,
                   str(fromlist))
         if fromlist:
             #MN: in this case 'm' is the final nested module already, don't walk the full 'name'
             vars = [
                 '.'.join(['', fl, autoload_var_name]) for fl in fromlist
             ]
         else:
             vars = ['.'.join([name, autoload_var_name])]
         for v in vars:
             try:
                 mm = m
                 #MN: walk the module chain and try to touch 'autoload_var_name' to trigger ROOT autoloading of namespaces
                 for comp in v.split('.')[1:]:
                     mm = getattr(mm, comp)
             except Exception:
                 pass
     return m
Exemplo n.º 15
0
    # To run on MC do e.g.
    ConfigFlags.Input.Files = ["../q221/myESD.pool.root"]
    # To run on data do e.g.
    # ConfigFlags.Input.Files = ["../q431/myESD.pool.root"]

    # Just enable ID for the moment.
    ConfigFlags.Detector.GeometryPixel = True
    ConfigFlags.Detector.GeometrySCT = True
    ConfigFlags.Detector.GeometryTRT = True

    # This should run serially for the moment.
    ConfigFlags.Concurrency.NumThreads = 1
    ConfigFlags.Concurrency.NumConcurrentEvents = 1

    ConfigFlags.lock()
    log.debug('Lock config flags now.')
    ConfigFlags.lock()

    cfg = MainServicesCfg(ConfigFlags)
    cfg.merge(PoolReadCfg(ConfigFlags))

    # Disable doExtrap if you would prefer not to use the extrapolator.
    topoAcc = DumpEventDataToJSONAlgCfg(ConfigFlags,
                                        doExtrap=False,
                                        OutputLevel=VERBOSE,
                                        OutputLocation="EventData_new.json")
    cfg.merge(topoAcc)

    cfg.run(10)
    f = open("DumpEventDataToJSONConfig.pkl", "wb")
    cfg.store(f)
Exemplo n.º 16
0
   for l in open( "/proc/self/status" ):
      if l.startswith( "VmSize:" ):
         return float(l.split()[1])/1024.

def grow_vmem(targetvmem_mb):
   v = vmem_mb()
   global l_extra_vmem_holder
   l_extra_vmem_holder = []
   while vmem_mb() < targetvmem_mb:
      l_extra_vmem_holder += [ " "*1024 ]
   v = vmem_mb() - v
   log.info( "Acquired %f mb of extra vmem",  v )

if not opts.cppyy_minvmem is None:
   min_cppyy_vmem_growth = opts.cppyy_minvmem
   log.debug( "Using cppyy minimum growth from CLI with value %.2f", min_cppyy_vmem_growth )
   vmem_before_cppyy = vmem_mb()
elif os.getenv( "ATHENA_PYCINTEX_MINVMEM" ):
   min_cppyy_vmem_growth = float(os.getenv( "ATHENA_PYCINTEX_MINVMEM" ))
   log.debug( "Using ATHENA_PYCINTEX_MINVMEM with value %.2f", min_cppyy_vmem_growth )
   vmem_before_cppyy = vmem_mb()
else:
   min_cppyy_vmem_growth = None

import cppyy
try:
   # try to touch ROOT5-only attribute
   cppyy.Cintex.Debug
except AttributeError:
   # ROOT 6
   from PyUtils.Helpers import ROOT6Setup
Exemplo n.º 17
0
def setupCommonServices():
    from AthenaCommon import CfgMgr
    from AthenaCommon.Logging import logging
    from AthenaCommon.Constants import INFO
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr, theApp
    from AthenaCommon.ConcurrencyFlags import jobproperties as jps

    # Setup messaging for Python and C++
    from AthenaCommon.Logging import log
    log.setFormat("%(asctime)s  Py:%(name)-31s %(levelname)7s %(message)s")

    # Create our own logger
    log = logging.getLogger('TriggerUnixStandardSetup::setupCommonServices:')

    from TrigServices.TrigServicesConfig import setupMessageSvc
    setupMessageSvc()

    # Do the default Atlas job configuration first
    import AthenaCommon.AtlasUnixStandardJob  # noqa: F401

    # Now do HLT/thread specific configuration (see e.g. AtlasThreadedJob.py)
    from StoreGate.StoreGateConf import SG__HiveMgrSvc
    svcMgr += SG__HiveMgrSvc("EventDataSvc",
                             NSlots=jps.ConcurrencyFlags.NumConcurrentEvents())

    import StoreGate.StoreGateConf as StoreGateConf
    svcMgr += StoreGateConf.StoreGateSvc("ConditionStore")

    # Configure the CoreDumpSvc
    if not hasattr(svcMgr, "CoreDumpSvc"):
        from AthenaServices.Configurables import CoreDumpSvc
        svcMgr += CoreDumpSvc()

    # ThreadPoolService thread local initialization
    from GaudiHive.GaudiHiveConf import ThreadPoolSvc
    svcMgr += ThreadPoolSvc("ThreadPoolSvc")
    svcMgr.ThreadPoolSvc.ThreadInitTools = ["ThreadInitTool"]

    from GaudiHive.GaudiHiveConf import AlgResourcePool
    svcMgr += AlgResourcePool(OutputLevel=INFO,
                              TopAlg=["AthSequencer/AthMasterSeq"])

    from AthenaCommon.AlgSequence import AlgSequence
    from SGComps.SGCompsConf import SGInputLoader
    topSequence = AlgSequence()
    topSequence += SGInputLoader(
        FailIfNoProxy=False)  # change to True eventually

    from AthenaCommon.AlgScheduler import AlgScheduler
    AlgScheduler.ShowDataDependencies(False)
    AlgScheduler.ShowControlFlow(False)
    AlgScheduler.setDataLoaderAlg('SGInputLoader')

    # Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute
    theApp.AuditAlgorithms = True
    from SGComps.SGCompsConf import SGCommitAuditor
    svcMgr.AuditorSvc += SGCommitAuditor()

    # setup ROOT6
    from PyUtils.Helpers import ROOT6Setup
    ROOT6Setup()

    # Setup online THistSvc unless specifically configured otherwise
    #    setup the THistSvc early and force the creation of the THistSvc
    #    so that it can be used by infrastructure services to book histograms
    #    (to avoid problems e.g. with histograms in ROBDataProviderSvc)
    if _Conf.useOnlineTHistSvc:
        if hasattr(svcMgr, 'THistSvc'):
            log.fatal(
                "The offline histogramming THistSvc is already in place.")
            raise RuntimeError(
                "Cannot setup online histogramming TrigMonTHistSvc")
        log.debug("Using online histogramming service (TrigMonTHistSvc)")
        from TrigServices.TrigServicesConf import TrigMonTHistSvc
        svcMgr += TrigMonTHistSvc("THistSvc")
    else:
        log.debug("Using offline histogramming service (THistSvc)")
        from GaudiSvc.GaudiSvcConf import THistSvc
        svcMgr += THistSvc()

    # StoreGateSvc
    svcMgr.StoreGateSvc.ActivateHistory = False

    # ProxyProviderSvc services configuration
    svcMgr += CfgMgr.ProxyProviderSvc()

    # --- ByteStreamAddressProviderSvc configuration
    svcMgr += CfgMgr.ByteStreamAddressProviderSvc()
    svcMgr.ProxyProviderSvc.ProviderNames += ["ByteStreamAddressProviderSvc"]
    theApp.CreateSvc += [svcMgr.ByteStreamAddressProviderSvc.getFullName()]

    # Initialization of DetDescrCnvSvc
    svcMgr += CfgMgr.DetDescrCnvSvc(
        # specify primary Identifier dictionary to be used
        IdDictName="IdDictParser/ATLAS_IDS.xml")

    theApp.CreateSvc += [svcMgr.DetDescrCnvSvc.getFullName()]
    svcMgr.EventPersistencySvc.CnvServices += ["DetDescrCnvSvc"]

    # Online services for ByteStream input/output
    from TrigByteStreamCnvSvc.TrigByteStreamCnvSvcConf import TrigEventSelectorByteStream
    from TrigByteStreamCnvSvc.TrigByteStreamCnvSvcConfig import TrigByteStreamInputSvc, TrigByteStreamCnvSvc
    svcMgr += TrigByteStreamCnvSvc(
        "ByteStreamCnvSvc")  # this name is hard-coded in some converters
    svcMgr.EventPersistencySvc.CnvServices += ["ByteStreamCnvSvc"]
    svcMgr += TrigByteStreamInputSvc("ByteStreamInputSvc")
    svcMgr += TrigEventSelectorByteStream(
        "EventSelector", ByteStreamInputSvc=svcMgr.ByteStreamInputSvc)
    theApp.EvtSel = "EventSelector"

    # Online event loop manager
    from TrigServices.TrigServicesConfig import HltEventLoopMgr
    loopMgr = HltEventLoopMgr("HltEventLoopMgr")
    loopMgr.WhiteboardSvc = "EventDataSvc"
    loopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName()
    loopMgr.EvtSel = svcMgr.EventSelector
    loopMgr.OutputCnvSvc = svcMgr.ByteStreamCnvSvc
    svcMgr += loopMgr
    theApp.EventLoop = loopMgr.name()

    from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg
    svcMgr.HltEventLoopMgr.ResultMaker = HLTResultMTMakerCfg()

    # Configuration of Interval of Validity Service
    svcMgr += CfgMgr.IOVSvc()

    # Configure COOL update helper tool
    from TrigServices.TrigServicesConfig import TrigCOOLUpdateHelper
    svcMgr.HltEventLoopMgr.CoolUpdateTool = TrigCOOLUpdateHelper()

    # Configure the online ROB data provider service
    from TrigServices.TrigServicesConfig import HltROBDataProviderSvc
    svcMgr += HltROBDataProviderSvc()

    # Explicitly set a few OutputLevels (needed because some services are created in
    # different order when running with the PSC)
    svcMgr.IncidentSvc.OutputLevel = theApp.OutputLevel
    svcMgr.ProxyProviderSvc.OutputLevel = theApp.OutputLevel
    svcMgr.StoreGateSvc.OutputLevel = theApp.OutputLevel

    return
Exemplo n.º 18
0
def _printConfiguration(loggerName):
    from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR

    from AthenaCommon.Logging import logging
    if loggerName == '':
        loggerName = 'TriggerUnixStandardSetup::_printConfiguration'
        
    log = logging.getLogger( loggerName )
    
    # --- print out configuration details
    # ---
    from AthenaCommon.AppMgr import theApp
    log.debug("---> Application Manager")
    log.debug(theApp)
    
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    log.debug("---> Service Manager")
    log.debug(svcMgr)

    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    log.debug("---> Algorithm Sequence")
    log.debug(topSequence)
    
    return
Exemplo n.º 19
0
def _setupCommonServices():
    from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
    
    # Add timestamp to python logger
    from AthenaCommon.Logging import log
    log.setFormat("%(asctime)s  Py:%(name)-31s %(levelname)7s %(message)s")

    from AthenaCommon.Logging import logging
    log = logging.getLogger( 'TriggerUnixStandardSetup::setupCommonServices:' )
     
    # Do the default Atlas job configuration first
    import AthenaCommon.AtlasUnixStandardJob

    # Now do HLT specific configuration
    from AthenaCommon import CfgMgr
    from AthenaCommon.AppMgr import theApp
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.AppMgr import ToolSvc

    # Check whether we are running in athenaXT
    # Only a minimal set of properties should depend on this
    import sys
    if sys.modules.has_key('HLTTestApps'):
        _Conf.athenaXT = True
        log.debug("Configuration for athenaXT running")
    else:
        _Conf.athenaXT = False
        log.debug("Configuration for online running")
        
    # setup ROOT6 if needed
    _setupRoot6IfNeeded()

    # StoreGateSvc
    svcMgr.StoreGateSvc.ActivateHistory = False
    
    # ProxyProviderSvc services configuration
    svcMgr += CfgMgr.ProxyProviderSvc()

    # --- ByteStreamAddressProviderSvc configuration
    svcMgr += CfgMgr.ByteStreamAddressProviderSvc()
    svcMgr.ProxyProviderSvc.ProviderNames += [ "ByteStreamAddressProviderSvc" ]
    theApp.CreateSvc += [ svcMgr.ByteStreamAddressProviderSvc.getFullName() ]

    # Initialization of DetDescrCnvSvc
    svcMgr += CfgMgr.DetDescrCnvSvc(
        # specify primary Identifier dictionary to be used
        IdDictName = "IdDictParser/ATLAS_IDS.xml"
        )
    theApp.CreateSvc += [ svcMgr.DetDescrCnvSvc.getFullName() ]
    svcMgr.EventPersistencySvc.CnvServices += [ "DetDescrCnvSvc" ]

    # --- ByteStreamCnvSvc configuration
    svcMgr += CfgMgr.ByteStreamCnvSvc("ByteStreamCnvSvc")
    svcMgr.EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
    
    # Disable history
    svcMgr += CfgMgr.HistorySvc()
    svcMgr.HistorySvc.Activate = False

    # Configuration of Interval of Validity Service
    svcMgr += CfgMgr.IOVSvc()
    
    # Configure TrigISHelper
    from TrigServices.TrigServicesConf import TrigISHelper
    ToolSvc += TrigISHelper("TrigISHelper")

    # Configure TrigPreFlightCheck
    from TrigServices.TrigServicesConf import TrigPreFlightCheck
    ToolSvc += TrigPreFlightCheck("TrigPreFlightCheck",
                                  ReleaseDirs = ["AtlasP1HLT","AtlasHLT"]
                                  )

    # Configure CoreDumpSvc
    if not hasattr(svcMgr,"CoreDumpSvc"):
        from AthenaServices.Configurables import CoreDumpSvc
        svcMgr += CoreDumpSvc()
        
    # Configure COOL update helper tool
    from TrigServices.TrigServicesConfig import TrigCOOLUpdateHelper
    _eventLoopMgr(svcMgr).CoolUpdateTool = TrigCOOLUpdateHelper()
            
    # Setup online THistSvc unless specifically configured otherwise
    if _Conf.useOnlineTHistSvc:
        if hasattr(svcMgr, 'THistSvc'):
            log.fatal("The offline histogramming THistSvc is already in place.")
            raise RuntimeError("Cannot setup online histogramming TrigMonTHistSvc")
        log.debug("Using online histogramming service (TrigMonTHistSvc)")
        from TrigServices.TrigServicesConf import TrigMonTHistSvc
        svcMgr += TrigMonTHistSvc("THistSvc")
    else:
        log.debug("Using offline histogramming service (THistSvc)")
        from GaudiSvc.GaudiSvcConf import THistSvc
        svcMgr += THistSvc()

    # Explicitly set a few OutputLevels (needed because some services are created in
    # different order when running with the PSC)
    svcMgr.StatusCodeSvc.OutputLevel = theApp.OutputLevel
    svcMgr.IncidentSvc.OutputLevel = theApp.OutputLevel
    svcMgr.ProxyProviderSvc.OutputLevel = theApp.OutputLevel
    svcMgr.StoreGateSvc.OutputLevel = theApp.OutputLevel
    
    return
Exemplo n.º 20
0
            return float(l.split()[1]) / 1024.


def grow_vmem(targetvmem_mb):
    v = vmem_mb()
    global l_extra_vmem_holder
    l_extra_vmem_holder = []
    while vmem_mb() < targetvmem_mb:
        l_extra_vmem_holder += [" " * 1024]
    v = vmem_mb() - v
    log.info("Acquired %f mb of extra vmem", v)


if not opts.cppyy_minvmem is None:
    min_cppyy_vmem_growth = opts.cppyy_minvmem
    log.debug("Using cppyy minimum growth from CLI with value %.2f",
              min_cppyy_vmem_growth)
    vmem_before_cppyy = vmem_mb()
elif os.getenv("ATHENA_PYCINTEX_MINVMEM"):
    min_cppyy_vmem_growth = float(os.getenv("ATHENA_PYCINTEX_MINVMEM"))
    log.debug("Using ATHENA_PYCINTEX_MINVMEM with value %.2f",
              min_cppyy_vmem_growth)
    vmem_before_cppyy = vmem_mb()
else:
    min_cppyy_vmem_growth = None

import cppyy
try:
    # try to touch ROOT5-only attribute
    cppyy.Cintex.Debug
except AttributeError:
    # ROOT 6
Exemplo n.º 21
0
 def loadDict(dict):
     if dict.find('Reflex') >= 0:
         log.debug(" LoadDict: ignoring dict " + dict)
     else:
         log.debug(" LoadDict: loading dict " + dict)
         return _load(dict)