diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 7ce5ebc71f80d0c3bcf3eaacb47528aa34c110fd..d7add7dfdde9b20d0280f6554b81e694ed83ed41 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +w# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging from AthenaCommon.Configurable import Configurable,ConfigurableService,ConfigurableAlgorithm,ConfigurableAlgTool @@ -7,7 +7,7 @@ from AthenaCommon.AlgSequence import AthSequencer from AthenaConfiguration.AthConfigFlags import AthConfigFlags import GaudiKernel.GaudiHandles as GaudiHandles -from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle +from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle import ast import collections @@ -235,6 +235,10 @@ class ComponentAccumulator(object): except AttributeError: newprop=None + if type(oldprop) != type(newprop): + raise DeduplicationFailed(" '%s' defined multiple times with conflicting types %s and %s" % \ + (comp.getJobOptName(),type(oldprop),type(newprop))) + #Note that getattr for a list property works, even if it's not in ValuedProperties if (oldprop!=newprop): #found property mismatch @@ -248,11 +252,10 @@ class ComponentAccumulator(object): for newtool in newprop: if newtool not in oldprop: oldprop+=[newtool,] continue - elif isinstance(oldprop,GaudiHandles.GaudiHandle): + elif isinstance(oldprop,ConfigurableAlgTool): self._deduplicateComponent(oldprop,newprop) pass elif isinstance(oldprop,GaudiHandles.GaudiHandleArray): - print oldprop,newprop for newTool in newprop: self._deduplicate(newTool,oldprop) pass @@ -272,6 +275,9 @@ class ComponentAccumulator(object): mergeprop=oldprop mergeprop.update(prop) setattr(comp,prop,mergeprop) + elif isinstance(oldprop,PrivateToolHandle): + # This is because we get a PTH if the Property is set to None, and for some reason the equality doesn't work as expected here. + continue else: #self._msg.error("component '%s' defined multiple times with mismatching configuration", svcs[i].getJobOptName()) raise DeduplicationFailed("component '%s' defined multiple times with mismatching property %s" % \