From 4fa7d934e211b6850a75806f12e666ba2f45fa3e Mon Sep 17 00:00:00 2001 From: TJ Khoo <khoo@cern.ch> Date: Thu, 22 Nov 2018 18:48:25 +0100 Subject: [PATCH] Add public tool and property printouts to ComponentAccumulator * With summariseProperties=True, properties will be printed if they are non-empty. The detector and event store props are ignored as they are usually common to all configs. Former-commit-id: 1970c3a53cb1201cd956532fd4ac4fec09337ca6 --- .../python/ComponentAccumulator.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 2a1e794e7a7..a4d253ad2ba 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -56,10 +56,30 @@ class ComponentAccumulator(object): - def printConfig(self, withDetails=False): + def printConfig(self, withDetails=False, summariseProps=False): self._msg.info( "Event Inputs" ) self._msg.info( self._eventInputs ) self._msg.info( "Event Algorithm Sequences" ) + + def printProperties(c, nestLevel = 0): + from AthenaCommon.Configurable import ConfigurableAlgTool + for propname, propval in c.getProperties().iteritems(): + # Ignore unset or empty lists + if propval=='<no value>' or propval==[]: + continue + # Printing EvtStore could be relevant for Views? + if propname in ["DetStore","EvtStore"]: + continue + + propstr = str(propval) + if propval.__class__ == PublicToolHandleArray: + ths = [str(th) for th in propval] + propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths)) + elif ConfigurableAlgTool in propval.__class__.__bases__: + propstr = propval.getFullName() + self._msg.info( " "*nestLevel +" * {0}: {1}".format(propname,propstr) ) + return + if withDetails: self._msg.info( self._sequence ) else: @@ -76,6 +96,8 @@ class ComponentAccumulator(object): printSeqAndAlgs(c, nestLevel ) else: self._msg.info( " "*nestLevel +"\__ "+ c.name() +" (alg)" ) + if summariseProps: + printProperties(c, nestLevel) printSeqAndAlgs(self._sequence) self._msg.info( "Condition Algorithms" ) @@ -88,6 +110,9 @@ class ComponentAccumulator(object): self._msg.info( "[" ) for t in self._publicTools: self._msg.info( " {0},".format(t.getFullName()) ) + # Not nested, for now + if summariseProps: + printProperties(t) self._msg.info( "]" ) -- GitLab