@@ -74,6 +74,7 @@ def _default_parameters_parsing(node):
7474 # for easy look up and merge of output_names
7575 main_nodes = dict ()
7676 not_used_nodes = {n .id : n for n in graph .nodes }
77+ standalone_input = None
7778 for i , (x , y ) in enumerate (graph .edges ):
7879 if x .id in not_used_nodes :
7980 del not_used_nodes [x .id ]
@@ -89,10 +90,16 @@ def _default_parameters_parsing(node):
8990 if i == 0 :
9091 # we are in the first element so we can specifically select
9192 # the type we are looking for
92- if at in input_x [0 ][1 ]:
93+ if input_x and at in input_x [0 ][1 ]:
9394 input_x [0 ][1 ] = at
94- else :
95+ elif input_x :
9596 input_x [0 ][1 ] = '** WARNING, NOT DEFINED **'
97+ else :
98+ # if we get to this point it means that the workflow has a
99+ # multiple commands starting from the main single input,
100+ # thus is fine to link them to the same raw data
101+ standalone_input = vals_x [0 ]
102+ input_x = [['' , at ]]
96103
97104 name_x = vals_x [0 ]
98105 name_y = vals_y [0 ]
@@ -106,6 +113,8 @@ def _default_parameters_parsing(node):
106113 name = inputs [b ]
107114 else :
108115 name = 'input_%s_%s' % (name_x , b )
116+ if standalone_input is not None :
117+ standalone_input = name
109118 vals = [name , a , b ]
110119 if vals not in nodes :
111120 inputs [b ] = name
@@ -152,13 +161,12 @@ def _default_parameters_parsing(node):
152161 # adding nodes without edges
153162 # as a first step if not_used_nodes is not empty we'll confirm that
154163 # nodes/edges are empty; in theory we should never hit this
155- if not_used_nodes and (nodes or edges ):
164+ if not_used_nodes and (nodes or edges ) and standalone_input is None :
156165 raise ValueError (
157166 'Error, please check your workflow configuration' )
158167
159168 # note that this block is similar but not identical to adding connected
160169 # nodes
161- standalone_input = None
162170 for i , (_ , x ) in enumerate (not_used_nodes .items ()):
163171 vals_x , input_x , output_x = _default_parameters_parsing (x )
164172 if input_x and at in input_x [0 ][1 ]:
@@ -181,8 +189,8 @@ def _default_parameters_parsing(node):
181189 else :
182190 name = 'input_%s_%s' % (name_x , b )
183191 # if standalone_input == name_x then this is the first time
184- # we are adding an standalone command and we need to add the node
185- # (only once) and store the name of the node for future usage
192+ # we are processing a standalone command so we need to add
193+ # the node and store the name of the node for future usage
186194 if standalone_input == name_x :
187195 nodes .append ([name , a , b ])
188196 standalone_input = name
0 commit comments