From 9ca32a1d0b498d35528133083a460a3bf29eae60 Mon Sep 17 00:00:00 2001 From: Edward Moyse <edward.moyse@cern.ch> Date: Mon, 1 Oct 2018 17:06:57 +0200 Subject: [PATCH] Fixing a few more bugs related to private tools. Former-commit-id: bc016db9b9039fbc88195cc9edb4e7064c201a61 --- .../python/ComponentAccumulator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 7ce5ebc71f8..d7add7dfdde 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" % \ -- GitLab