Skip to content

Commit 613db09

Browse files
committed
handle special case of get_list()
1 parent 1b245ae commit 613db09

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

python_workflow_definition/src/python_workflow_definition/pyiron_workflow.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ def load_workflow_json(file_name: str) -> Workflow:
241241
)
242242
counter_dict = {k: -1 for k in total_counter_dict.keys()}
243243
wf = Workflow(file_name.split(".")[0])
244+
nodes_look_up_dict = {
245+
node["id"]: node["value"] for node in content[NODES_LABEL]
246+
}
244247
for node_dict in content[NODES_LABEL]:
245248
if node_dict["type"] == "function":
246249
if node_dict["value"] == "python_workflow_definition.shared.get_dict":
@@ -295,8 +298,11 @@ def load_workflow_json(file_name: str) -> Workflow:
295298
injected_attribute_access = nodes[source_id].__getitem__(source_port)
296299
upstream = injected_attribute_access
297300
downstream = nodes[target_id]
298-
setattr(downstream.inputs, target_port, upstream) # Exploit input panel magic
299-
# Warning: edge setup routine is bespoke for an environment where all nodes return
300-
# a single value or a dictionary
301+
if nodes_look_up_dict[target_id] == "python_workflow_definition.shared.get_list":
302+
setattr(downstream.inputs, "s_" + target_port, upstream)
303+
else:
304+
setattr(downstream.inputs, target_port, upstream) # Exploit input panel magic
305+
# Warning: edge setup routine is bespoke for an environment where all nodes return
306+
# a single value or a dictionary
301307

302308
return wf

0 commit comments

Comments
 (0)