@@ -770,16 +770,46 @@ def _check_nodes(self, nodes):
770
770
def _has_attr (self , parameter , subtype = "in" ):
771
771
"""Checks if a parameter is available as an input or output
772
772
"""
773
+ hierarchy = parameter .split ("." )
774
+ attrname = hierarchy .pop ()
775
+ nodename = hierarchy .pop ()
776
+
777
+ targetworkflow = self
778
+ for workflowname in hierarchy :
779
+ workflow = None
780
+ for node in targetworkflow ._graph .nodes ():
781
+ if node .name == workflowname :
782
+ if isinstance (node , Workflow ):
783
+ workflow = node
784
+ break
785
+ if workflow is None :
786
+ return False
787
+ targetworkflow = workflow
788
+
789
+ targetnode = None
790
+ for node in targetworkflow ._graph .nodes ():
791
+ if node .name == nodename :
792
+ if isinstance (node , Workflow ):
793
+ return False
794
+ else :
795
+ targetnode = node
796
+ break
797
+ if targetnode is None :
798
+ return False
799
+
773
800
if subtype == "in" :
774
- subobject = self .inputs
801
+ if not hasattr (node .inputs , attrname ):
802
+ return False
775
803
else :
776
- subobject = self .outputs
777
- attrlist = parameter .split ("." )
778
- cur_out = subobject
779
- for attr in attrlist :
780
- if not hasattr (cur_out , attr ):
804
+ if not hasattr (node .outputs , attrname ):
781
805
return False
782
- cur_out = getattr (cur_out , attr )
806
+
807
+ if subtype == "in" :
808
+ for _ , _ , d in targetworkflow ._graph .in_edges (nbunch = targetnode , data = True ):
809
+ for cd in d ["connect" ]:
810
+ if attrname == cd [1 ]:
811
+ return False
812
+
783
813
return True
784
814
785
815
def _get_parameter_node (self , parameter , subtype = "in" ):
0 commit comments