File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 22import re
33import typing as ty
44import inspect
5+ import logging
56from operator import attrgetter
67import attrs
78from ..utils import extract_args
1112 from ..workflow import WorkflowConverter
1213
1314
15+ logger = logging .getLogger (__name__ )
16+
17+
1418@attrs .define
1519class AssignmentStatement :
1620
@@ -368,7 +372,28 @@ def add_input_connection(self, conn: ConnectionStatement):
368372 bool
369373 whether the connection is an input of the workflow
370374 """
371-
375+ # Ensure that there is only 1 non-conditional connection to the input
376+ if not conn .conditional :
377+ try :
378+ prev = next (
379+ c
380+ for c in self .in_conns
381+ if c .target_in == conn .target_in and not c .conditional
382+ )
383+ except StopIteration :
384+ pass
385+ else :
386+ logger .warning (
387+ "'%s' input field of '%s' node receives multiple connections: "
388+ "replacing %s:%s with %s:%s" ,
389+ conn .target_in ,
390+ self .name ,
391+ prev .source_name ,
392+ prev .source_out ,
393+ conn .source_name ,
394+ conn .source_out ,
395+ )
396+ self .in_conns .remove (prev )
372397 self .in_conns .append (conn )
373398
374399 def add_output_connection (self , conn : ConnectionStatement ) -> bool :
Original file line number Diff line number Diff line change @@ -317,7 +317,9 @@ class WorkflowConverter:
317317 nodes : ty .Dict [str , ty .List [AddInterfaceStatement ]] = attrs .field (
318318 factory = dict , repr = False
319319 )
320- _unprocessed_connections : ty .List [ConnectionStatement ] = attrs .field (factory = list , repr = False )
320+ _unprocessed_connections : ty .List [ConnectionStatement ] = attrs .field (
321+ factory = list , repr = False
322+ )
321323 _input_mapping : ty .Dict [str , WorkflowInput ] = attrs .field (
322324 factory = dict ,
323325 init = False ,
You can’t perform that action at this time.
0 commit comments