Skip to content

Commit 1df9b19

Browse files
committed
bug fix
1 parent fbbcc08 commit 1df9b19

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

python_workflow_definition/src/python_workflow_definition/pyiron_workflow.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,25 @@ def write_workflow_json(graph_as_dict: dict, file_name: str = "workflow.json"):
157157

158158
edge_updated_lst = []
159159
for edge in edge_new_lst:
160-
edge_updated_lst.append(
161-
{
162-
SOURCE_LABEL: mapping_dict[edge[SOURCE_LABEL]],
163-
SOURCE_PORT_LABEL: edge[SOURCE_PORT_LABEL],
164-
TARGET_LABEL: mapping_dict[edge[TARGET_LABEL]],
165-
TARGET_PORT_LABEL: edge[TARGET_PORT_LABEL],
166-
}
167-
)
160+
source_node = nodes_new_dict[edge[SOURCE_LABEL]]
161+
if isfunction(source_node) and source_node.__name__ == edge[SOURCE_PORT_LABEL]:
162+
edge_updated_lst.append(
163+
{
164+
SOURCE_LABEL: mapping_dict[edge[SOURCE_LABEL]],
165+
SOURCE_PORT_LABEL: None,
166+
TARGET_LABEL: mapping_dict[edge[TARGET_LABEL]],
167+
TARGET_PORT_LABEL: edge[TARGET_PORT_LABEL],
168+
}
169+
)
170+
else:
171+
edge_updated_lst.append(
172+
{
173+
SOURCE_LABEL: mapping_dict[edge[SOURCE_LABEL]],
174+
SOURCE_PORT_LABEL: edge[SOURCE_PORT_LABEL],
175+
TARGET_LABEL: mapping_dict[edge[TARGET_LABEL]],
176+
TARGET_PORT_LABEL: edge[TARGET_PORT_LABEL],
177+
}
178+
)
168179

169180
PythonWorkflowDefinitionWorkflow(
170181
**set_result_node(

0 commit comments

Comments
 (0)