@@ -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