2626
2727def load_workflow_json (file_name : str ) -> WorkGraph :
2828
29- data = PythonWorkflowDefinitionWorkflow .load_json_file (file_name = file_name )
29+ data = PythonWorkflowDefinitionWorkflow .load_json_file (file_name = file_name )
3030 # data = remove_result(workflow_dict=workflow_dict)
3131
3232 wg = WorkGraph ()
@@ -41,9 +41,7 @@ def load_workflow_json(file_name: str) -> WorkGraph:
4141 func = getattr (mod , m )
4242 decorated_func = task (outputs = namespace ())(func )
4343 new_task = wg .add_task (decorated_func )
44- new_task .spec = replace (
45- new_task .spec , schema_source = SchemaSource .EMBEDDED
46- )
44+ new_task .spec = replace (new_task .spec , schema_source = SchemaSource .EMBEDDED )
4745 task_name_mapping [id ] = new_task
4846 else :
4947 # data task
@@ -58,7 +56,9 @@ def load_workflow_json(file_name: str) -> WorkGraph:
5856 # in this case, we add the input socket
5957 if isinstance (to_task , Task ):
6058 if link [TARGET_PORT_LABEL ] not in to_task .inputs :
61- to_socket = to_task .add_input_spec ("workgraph.any" , name = link [TARGET_PORT_LABEL ])
59+ to_socket = to_task .add_input_spec (
60+ "workgraph.any" , name = link [TARGET_PORT_LABEL ]
61+ )
6262 else :
6363 to_socket = to_task .inputs [link [TARGET_PORT_LABEL ]]
6464 from_task = task_name_mapping [str (link [SOURCE_LABEL ])]
@@ -70,7 +70,7 @@ def load_workflow_json(file_name: str) -> WorkGraph:
7070 link [SOURCE_PORT_LABEL ] = "result"
7171 # if link[SOURCE_PORT_LABEL] == 'result':
7272 # pass
73- # link[SOURCE_PORT_LABEL] = "__result__"
73+ # link[SOURCE_PORT_LABEL] = "__result__"
7474 # because we are not define the outputs explicitly during the pythonjob creation
7575 # we add it here, and assume the output exit
7676 if link [SOURCE_PORT_LABEL ] not in from_task .outputs :
@@ -94,7 +94,7 @@ def write_workflow_json(wg: WorkGraph, file_name: str) -> dict:
9494 node_name_mapping = {}
9595 data_node_name_mapping = {}
9696 i = 0
97- GRAPH_LEVEL_NAMES = [' graph_inputs' , ' graph_outputs' , ' graph_ctx' ]
97+ GRAPH_LEVEL_NAMES = [" graph_inputs" , " graph_outputs" , " graph_ctx" ]
9898
9999 for node in wg .tasks :
100100
@@ -120,7 +120,6 @@ def write_workflow_json(wg: WorkGraph, file_name: str) -> dict:
120120 link_data [SOURCE_PORT_LABEL ] = link_data .pop ("from_socket" )
121121 data [EDGES_LABEL ].append (link_data )
122122
123-
124123 for node in wg .tasks :
125124 for input in node .inputs :
126125 # assume namespace is not used as input
0 commit comments