@@ -285,26 +285,39 @@ def write_workflow_json(
285285 )
286286
287287 nodes_store_lst = []
288- for k , v in nodes_new_dict .items ():
288+ translate_dict = {}
289+ for i , k in enumerate (nodes_new_dict .keys ()):
290+ v = nodes_new_dict [v ]
291+ translate_dict [k ] = i
289292 if isfunction (v ):
290293 mod = v .__module__
291294 if mod == "python_workflow_definition.pyiron_base" :
292295 mod = "python_workflow_definition.shared"
293296 nodes_store_lst .append (
294- {"id" : k , "type" : "function" , "value" : mod + "." + v .__name__ }
297+ {"id" : i , "type" : "function" , "value" : mod + "." + v .__name__ }
295298 )
296299 elif isinstance (v , np .ndarray ):
297- nodes_store_lst .append ({"id" : k , "type" : "input" , "value" : v .tolist ()})
300+ nodes_store_lst .append ({"id" : i , "type" : "input" , "value" : v .tolist ()})
298301 else :
299- nodes_store_lst .append ({"id" : k , "type" : "input" , "value" : v })
300-
302+ nodes_store_lst .append ({"id" : i , "type" : "input" , "value" : v })
303+
304+ edges_store_lst = [
305+ {
306+ TARGET_LABEL : translate_dict [edge [TARGET_LABEL ]],
307+ TARGET_PORT_LABEL : edge [TARGET_PORT_LABEL ],
308+ SOURCE_LABEL : translate_dict [edge [SOURCE_LABEL ]],
309+ SOURCE_PORT_LABEL : edge [SOURCE_PORT_LABEL ],
310+ }
311+ for edge in edges_new_lst
312+ ]
313+
301314 PythonWorkflowDefinitionWorkflow (
302315 ** set_result_node (
303316 workflow_dict = update_node_names (
304317 workflow_dict = {
305318 VERSION_LABEL : VERSION_NUMBER ,
306319 NODES_LABEL : nodes_store_lst ,
307- EDGES_LABEL : edges_new_lst ,
320+ EDGES_LABEL : edges_store_lst ,
308321 }
309322 )
310323 )
0 commit comments