@@ -83,7 +83,6 @@ def _get_function(workflow):
8383
8484def _write_function_cwl (workflow ):
8585 function_nodes_dict , funct_dict = _get_function (workflow )
86- file_lst = []
8786
8887 for i in function_nodes_dict .keys ():
8988 template = {
@@ -108,26 +107,24 @@ def _write_function_cwl(workflow):
108107 },
109108 "outputs" : {},
110109 }
111- file_name = function_nodes_dict [i ].split ("." )[- 1 ] + ".cwl"
112- if file_name not in file_lst :
113- file_lst .append (file_name )
114- template ["inputs" ]["workflowfile" ]["default" ]["location" ] = (
115- function_nodes_dict [i ].split ("." )[0 ] + ".py"
116- )
110+ file_name = function_nodes_dict [i ].split ("." )[- 1 ] + "_" + str (i ) + ".cwl"
111+ template ["inputs" ]["workflowfile" ]["default" ]["location" ] = (
112+ function_nodes_dict [i ].split ("." )[0 ] + ".py"
113+ )
114+ template ["inputs" ].update (
115+ _get_function_template (function_name = function_nodes_dict [i ])
116+ )
117+ for j , arg in enumerate (funct_dict [i ]["targetPorts" ]):
117118 template ["inputs" ].update (
118- _get_function_template ( function_name = function_nodes_dict [ i ] )
119+ _get_function_argument ( argument = arg , position = 4 + j )
119120 )
120- for j , arg in enumerate (funct_dict [i ]["targetPorts" ]):
121- template ["inputs" ].update (
122- _get_function_argument (argument = arg , position = 4 + j )
123- )
124- for out in funct_dict [i ]["sourcePorts" ]:
125- if out is None :
126- template ["outputs" ].update (_get_output_name (output_name = "result" ))
127- else :
128- template ["outputs" ].update (_get_output_name (output_name = out ))
129- with open (file_name , "w" ) as f :
130- dump (template , f , Dumper = Dumper )
121+ for out in funct_dict [i ]["sourcePorts" ]:
122+ if out is None :
123+ template ["outputs" ].update (_get_output_name (output_name = "result" ))
124+ else :
125+ template ["outputs" ].update (_get_output_name (output_name = out ))
126+ with open (file_name , "w" ) as f :
127+ dump (template , f , Dumper = Dumper )
131128
132129
133130def _write_workflow_config (workflow ):
@@ -194,7 +191,7 @@ def _write_workflow(workflow):
194191 }
195192 for t in total_new_lst :
196193 ind = t [0 ]
197- node_script = step_name_lst [ind ] + ".cwl"
194+ node_script = step_name_lst [ind ] + "_" + str ( ind ) + " .cwl"
198195 output = [
199196 o + "_file" if o is not None else "result_file"
200197 for o in funct_dict [ind ]["sourcePorts" ]
0 commit comments