Skip to content
Snippets Groups Projects
Commit 8f80c772 authored by TJ Khoo's avatar TJ Khoo
Browse files

Change to use isinstance for type checking. Handle public and private toolhandle arrays better.

Former-commit-id: 08a607f4
parent 13afc06c
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ from AthenaCommon.AlgSequence import AthSequencer ...@@ -7,7 +7,7 @@ from AthenaCommon.AlgSequence import AthSequencer
from AthenaConfiguration.AthConfigFlags import AthConfigFlags from AthenaConfiguration.AthConfigFlags import AthConfigFlags
import GaudiKernel.GaudiHandles as GaudiHandles import GaudiKernel.GaudiHandles as GaudiHandles
from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle, PrivateToolHandleArray
import ast import ast
import collections import collections
...@@ -72,10 +72,13 @@ class ComponentAccumulator(object): ...@@ -72,10 +72,13 @@ class ComponentAccumulator(object):
continue continue
propstr = str(propval) propstr = str(propval)
if propval.__class__ == PublicToolHandleArray: if isinstance(propval,PublicToolHandleArray):
ths = [str(th) for th in propval] ths = [th.getFullName() for th in propval]
propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths)) propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths))
elif ConfigurableAlgTool in propval.__class__.__bases__: elif isinstance(propval,PrivateToolHandleArray):
ths = [th.getFullName() for th in propval]
propstr = "PrivateToolHandleArray([ {0} ])".format(', '.join(ths))
elif isinstance(propval,ConfigurableAlgTool):
propstr = propval.getFullName() propstr = propval.getFullName()
self._msg.info( " "*nestLevel +" * {0}: {1}".format(propname,propstr) ) self._msg.info( " "*nestLevel +" * {0}: {1}".format(propname,propstr) )
return return
...@@ -426,7 +429,7 @@ class ComponentAccumulator(object): ...@@ -426,7 +429,7 @@ class ComponentAccumulator(object):
existingAlg = findAlgorithm( dest, c.name(), depth=1 ) existingAlg = findAlgorithm( dest, c.name(), depth=1 )
if existingAlg: if existingAlg:
if existingAlg != c: # if it is the same we can just skip it, else this indicates an error if existingAlg != c: # if it is the same we can just skip it, else this indicates an error
raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name() ) ) raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name() ) )
else: # absent, adding else: # absent, adding
self._msg.debug(" Merging algorithm %s to a sequence %s", c.name(), dest.name() ) self._msg.debug(" Merging algorithm %s to a sequence %s", c.name(), dest.name() )
dest += c dest += c
......
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