Skip to content
Snippets Groups Projects
Verified Commit 040ac54f authored by Tadej Novak's avatar Tadej Novak
Browse files

Add new configuration for AddressRemappingSvc

parent 421c8372
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,8 @@ _propsToUnify={"GeoModelSvc.DetectorTools":unifySet,
"dummyService.AList": unifySet,
"dummyTool.BList" : unifySet,
"*.InputMakerInputDecisions": unifySet,
"*.InputMakerOutputDecisions": unifySet
"*.InputMakerOutputDecisions": unifySet,
"AddressRemappingSvc.TypeKeyRenameMaps": unifySet,
}
def setUnificationFunction(key, function):
......
......@@ -52,3 +52,6 @@ atlas_add_test( SGFolder_test
LINK_LIBRARIES TestTools GaudiKernel SGTools AthenaKernel AthenaBaseComps AthLinks
EXTRA_PATTERNS "^JobOptionsSvc +INFO|DEBUG Property update for OutputLevel"
ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
atlas_add_test( AddressRemappingConfig_test
SCRIPT test/AddressRemappingConfig_test.py )
""" Helpers for configuring the AddressRemappingSvc
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon import Logging
def AddressRemappingCfg(renameMaps=[]):
"""
Creates a ComponentAccumulator instance containing the
AddressRemappingSvc and other needed services
"""
from SGComps.SGCompsConf import AddressRemappingSvc, ProxyProviderSvc
acc = ComponentAccumulator()
svc = AddressRemappingSvc()
svc.TypeKeyRenameMaps = renameMaps
acc.addService(svc)
acc.addService(ProxyProviderSvc(ProviderNames=["AddressRemappingSvc"]))
return acc
def InputRenameCfg(type, from_name, to_name):
""" Add a new input renaming.
For example:
InputRenameCfg ("Foo", "foo", "bar")
to rename the object of type Foo named `foo' to `bar'.
May also be used to rename dynamic (but NOT static) auxiliary variables:
InputRenameCfg ("Foo", "foo.d1", "foo.x1")
If both are combined, write it like this:
InputRenameCfg ("Foo", "foo", "bar")
InputRenameCfg ("Foo", "foo.d1", "bar.x1")
"""
return AddressRemappingCfg([ '%s#%s->%s' % (type, from_name, to_name) ])
def InputOverwriteCfg(from_type, from_name, to_type, to_name):
""" Add a new type overwrite mapping. """
return AddressRemappingCfg([ '%s#%s->%s#%s' % (from_type, from_name,
to_type, to_name) ])
Py:ComponentAccumulator INFO Event Inputs
Py:ComponentAccumulator INFO set([])
Py:ComponentAccumulator INFO Event Algorithm Sequences
Py:ComponentAccumulator INFO /***** Algorithm AthSequencer/AthAlgSeq ************************************************************
|-Atomic = False
|-AuditAlgorithms = False
|-AuditBeginRun = False
|-AuditEndRun = False
|-AuditExecute = False
|-AuditFinalize = False
|-AuditInitialize = False
|-AuditReinitialize = False
|-AuditRestart = False
|-AuditStart = False
|-AuditStop = False
|-Cardinality = 0
|-ContinueEventloopOnFPE = False
|-DetStore = ServiceHandle('StoreGateSvc/DetectorStore')
|-Enable = True
|-ErrorCounter = 0
|-ErrorMax = 1
|-EvtStore = ServiceHandle('StoreGateSvc')
|-ExtraInputs = [] (default: [])
|-ExtraOutputs = [] (default: [])
|-FilterCircularDependencies = True
|-IgnoreFilterPassed = False
|-IsIOBound = False
|-Members = [] (default: [])
|-ModeOR = False
|-MonitorService = 'MonitorSvc'
|-NeededResources = [] (default: [])
|-OutputLevel = 0
|-RegisterForContextService = False
|-Sequential = True (default: False)
|-StopOverride = False
|-TimeOut = 0.0
|-Timeline = True
\----- (End of Algorithm AthSequencer/AthAlgSeq) ---------------------------------------------------
Py:ComponentAccumulator INFO Condition Algorithms
Py:ComponentAccumulator INFO []
Py:ComponentAccumulator INFO Services
Py:ComponentAccumulator INFO ['AddressRemappingSvc', 'ProxyProviderSvc']
Py:ComponentAccumulator INFO Outputs
Py:ComponentAccumulator INFO {}
Py:ComponentAccumulator INFO Public Tools
Py:ComponentAccumulator INFO [
Py:ComponentAccumulator INFO ]
/***** Service ProxyProviderSvc/ProxyProviderSvc ***************************************************
|-AuditFinalize = False
|-AuditInitialize = False
|-AuditReinitialize = False
|-AuditRestart = False
|-AuditServices = False
|-AuditStart = False
|-AuditStop = False
|-OutputLevel = 0
|-ProviderNames = ['AddressRemappingSvc'] (default: [])
\----- (End of Service ProxyProviderSvc/ProxyProviderSvc) ------------------------------------------
/***** Service AddressRemappingSvc/AddressRemappingSvc *********************************************
|-AlgResourcePool = ServiceHandle('AlgResourcePool')
|-AuditFinalize = False
|-AuditInitialize = False
|-AuditReinitialize = False
|-AuditRestart = False
|-AuditServices = False
|-AuditStart = False
|-AuditStop = False
|-OutputLevel = 0
|-ProxyDict = ServiceHandle('StoreGateSvc')
|-SkipBadRemappings = False
|-TypeKeyOverwriteMaps = [] (default: [])
|-TypeKeyRenameMaps = ['Type1#from->to', 'Type2#a->b', 'Foo#foo->bar', 'Foo#foo.d1->bar.x1', 'FromType#fromName->ToType#toName']
| (default: [])
\----- (End of Service AddressRemappingSvc/AddressRemappingSvc) ------------------------------------
#!/usr/bin/env python
"""Run tests on AddressRemappingConfig.py
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaCommon.Configurable import Configurable
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from SGComps.AddressRemappingConfig import AddressRemappingCfg, InputRenameCfg, InputOverwriteCfg
# Set up logging and new style config
Configurable.configurableRun3Behavior = True
# Construct our accumulator to run
acc = ComponentAccumulator()
# Create empty address remapping service
acc.merge(AddressRemappingCfg())
# Create address remapping service with a pre-defined map
acc.merge(AddressRemappingCfg(["Type1#from->to", "Type2#a->b"]))
# Test helper functions
acc.merge(InputRenameCfg("Foo", "foo", "bar"))
acc.merge(InputRenameCfg("Foo", "foo.d1", "bar.x1"))
acc.merge(InputOverwriteCfg("FromType", "fromName", "ToType", "toName"))
# Dump config
acc.printConfig(withDetails=True)
# For test purposes only!
acc.wasMerged()
# Test our services
print(acc.getService("ProxyProviderSvc"))
svc = acc.getService("AddressRemappingSvc")
print(svc)
assert(svc.TypeKeyRenameMaps == [
"Type1#from->to",
"Type2#a->b",
"Foo#foo->bar",
"Foo#foo.d1->bar.x1",
"FromType#fromName->ToType#toName",
])
......@@ -56,6 +56,6 @@ def PoolReadCfg(configFlags):
result.addService(evSel)
result.setAppProperty("EvtSel",evSel.getFullJobOptName())
#(possibly) missing: MetaDataSvc, AddressRemappingSvc
#(possibly) missing: MetaDataSvc
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment