Skip to content

Commit 295c39e

Browse files
committed
push for xing to test locally
1 parent e40adbd commit 295c39e

File tree

2 files changed

+95
-18
lines changed

2 files changed

+95
-18
lines changed

jobflow_simple.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"version": "0.1.0",
3+
"nodes": [
4+
{
5+
"id": 0,
6+
"type": "function",
7+
"value": "workflow.get_prod_and_div"
8+
},
9+
{
10+
"id": 1,
11+
"type": "function",
12+
"value": "workflow.get_sum"
13+
},
14+
{
15+
"id": 2,
16+
"type": "function",
17+
"value": "workflow.get_square"
18+
},
19+
{
20+
"id": 3,
21+
"type": "input",
22+
"name": "x",
23+
"value": 1
24+
},
25+
{
26+
"id": 4,
27+
"type": "input",
28+
"name": "y",
29+
"value": 2
30+
},
31+
{
32+
"id": 5,
33+
"type": "output",
34+
"name": "result"
35+
}
36+
],
37+
"edges": [
38+
{
39+
"target": 0,
40+
"targetPort": "x",
41+
"source": 3,
42+
"sourcePort": null
43+
},
44+
{
45+
"target": 0,
46+
"targetPort": "y",
47+
"source": 4,
48+
"sourcePort": null
49+
},
50+
{
51+
"target": 1,
52+
"targetPort": "x",
53+
"source": 0,
54+
"sourcePort": "prod"
55+
},
56+
{
57+
"target": 1,
58+
"targetPort": "y",
59+
"source": 0,
60+
"sourcePort": "div"
61+
},
62+
{
63+
"target": 2,
64+
"targetPort": "x",
65+
"source": 1,
66+
"sourcePort": null
67+
},
68+
{
69+
"target": 5,
70+
"targetPort": null,
71+
"source": 2,
72+
"sourcePort": null
73+
}
74+
]
75+
}

src/python_workflow_definition/aiida.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,36 @@ def load_workflow_json(file_name: str) -> WorkGraph:
5353
to_task = task_name_mapping[str(link[TARGET_LABEL])]
5454
# if the input is not exit, it means we pass the data into to the kwargs
5555
# in this case, we add the input socket
56-
try:
57-
if link[TARGET_PORT_LABEL] not in to_task.inputs:
58-
to_socket = to_task.add_input("workgraph.any", name=link[TARGET_PORT_LABEL])
59-
else:
60-
to_socket = to_task.inputs[link[TARGET_PORT_LABEL]]
61-
except:
62-
breakpoint()
56+
if link[TARGET_PORT_LABEL] not in to_task.inputs:
57+
to_socket = to_task.add_input_spec("workgraph.any", name=link[TARGET_PORT_LABEL])
58+
else:
59+
to_socket = to_task.inputs[link[TARGET_PORT_LABEL]]
6360
from_task = task_name_mapping[str(link[SOURCE_LABEL])]
6461
if isinstance(from_task, orm.Data):
6562
to_socket.value = from_task
6663
else:
6764
try:
6865
if link[SOURCE_PORT_LABEL] is None:
6966
link[SOURCE_PORT_LABEL] = "result"
67+
# if link[SOURCE_PORT_LABEL] == 'result':
68+
# pass
69+
# link[SOURCE_PORT_LABEL] = "__result__"
7070
# because we are not define the outputs explicitly during the pythonjob creation
7171
# we add it here, and assume the output exit
72-
if link[SOURCE_PORT_LABEL] not in from_task.outputs:
73-
# if str(link["sourcePort"]) not in from_task.outputs:
74-
from_socket = from_task.add_output(
75-
"workgraph.any",
76-
name=link[SOURCE_PORT_LABEL],
77-
# name=str(link["sourcePort"]),
78-
# metadata={"is_function_output": True},
79-
)
80-
else:
81-
from_socket = from_task.outputs[link[SOURCE_PORT_LABEL]]
72+
try:
73+
if link[SOURCE_PORT_LABEL] not in from_task.outputs:
74+
# if str(link["sourcePort"]) not in from_task.outputs:
75+
from_socket = from_task.add_output_spec(
76+
"workgraph.any",
77+
name=link[SOURCE_PORT_LABEL],
78+
)
79+
else:
80+
from_socket = from_task.outputs[link[SOURCE_PORT_LABEL]]
8281

83-
wg.add_link(from_socket, to_socket)
82+
wg.add_link(from_socket, to_socket)
83+
except:
84+
breakpoint()
85+
pass
8486
except Exception as e:
8587
traceback.print_exc()
8688
print("Failed to link", link, "with error:", e)

0 commit comments

Comments
 (0)