Skip to content

Commit 568c7cc

Browse files
committed
Fix aiida_to_pyiron_base_simple
1 parent e3a22b7 commit 568c7cc

File tree

2 files changed

+298
-81
lines changed

2 files changed

+298
-81
lines changed

aiida_to_jobflow_simple.ipynb

Lines changed: 35 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 7,
5+
"execution_count": 1,
66
"metadata": {},
7-
"outputs": [],
7+
"outputs": [
8+
{
9+
"name": "stderr",
10+
"output_type": "stream",
11+
"text": [
12+
"/home/geiger_j/.aiida_venvs/adis/lib/python3.10/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.\n",
13+
" \"cipher\": algorithms.TripleDES,\n",
14+
"/home/geiger_j/.aiida_venvs/adis/lib/python3.10/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.\n",
15+
" \"class\": algorithms.TripleDES,\n"
16+
]
17+
}
18+
],
819
"source": [
9-
"from python_workflow_definition.aiida import write_workflow_json\n",
20+
"from python_workflow_definition.aiida import write_workflow_json, construct_wg_simple\n",
1021
"from python_workflow_definition.jobflow import load_workflow_json\n",
11-
"from aiida_workgraph import task, WorkGraph\n",
1222
"from jobflow.managers.local import run_locally\n",
1323
"\n",
1424
"from aiida import load_profile\n",
@@ -19,93 +29,37 @@
1929
},
2030
{
2131
"cell_type": "code",
22-
"execution_count": 8,
32+
"execution_count": 2,
2333
"metadata": {},
2434
"outputs": [],
2535
"source": [
26-
"from simple_workflow import (\n",
27-
" add_x_and_y as _add_x_and_y, \n",
28-
" add_x_and_y_and_z as _add_x_and_y_and_z,\n",
29-
")"
36+
"from simple_workflow import add_x_and_y, add_x_and_y_and_z"
3037
]
3138
},
3239
{
3340
"cell_type": "code",
34-
"execution_count": 9,
41+
"execution_count": 3,
3542
"metadata": {},
3643
"outputs": [
3744
{
3845
"name": "stdout",
3946
"output_type": "stream",
4047
"text": [
48+
"outputs [{'identifier': 'workgraph.any', 'name': 'result'}]\n",
49+
"outputs ['x', 'y', 'z']\n",
4150
"outputs [{'identifier': 'workgraph.any', 'name': 'result'}]\n"
4251
]
43-
},
44-
{
45-
"data": {
46-
"application/vnd.jupyter.widget-view+json": {
47-
"model_id": "826872d2011e4daaaf3f173b38bf49dc",
48-
"version_major": 2,
49-
"version_minor": 1
50-
},
51-
"text/plain": [
52-
"NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'wg-simp…"
53-
]
54-
},
55-
"execution_count": 9,
56-
"metadata": {},
57-
"output_type": "execute_result"
5852
}
5953
],
6054
"source": [
61-
"def pickle_node(value):\n",
62-
" \"\"\"Handle data nodes\"\"\"\n",
63-
" return value\n",
64-
"\n",
65-
"helper_1 = task.pythonjob()(pickle_node)\n",
66-
"helper_2 = task.pythonjob()(pickle_node)\n",
67-
"\n",
68-
"add_x_and_y = task.pythonjob(outputs=[\"x\", \"y\", \"z\"])(_add_x_and_y)\n",
69-
"add_x_and_y_and_z = task.pythonjob()(_add_x_and_y_and_z)\n",
70-
"\n",
71-
"# workgraph = write_workflow_json(filename='workflow_simple.json')\n",
72-
"\n",
73-
"# TODO: Create inputs rather than tasks out of data nodes\n",
74-
"wg = WorkGraph('wg-simple')\n",
75-
"\n",
76-
"helper_task1 = wg.add_task(\n",
77-
" helper_1,\n",
78-
" name=\"x\",\n",
79-
" value=1\n",
80-
")\n",
81-
"\n",
82-
"helper_task2 = wg.add_task(\n",
83-
" helper_2,\n",
84-
" name=\"y\",\n",
85-
" value=2\n",
86-
")\n",
87-
"\n",
88-
"add_x_and_y_task = wg.add_task(\n",
89-
" add_x_and_y,\n",
90-
" name='add_x_and_y',\n",
91-
" x=helper_task1.outputs.result,\n",
92-
" y=helper_task2.outputs.result,\n",
93-
")\n",
94-
"\n",
95-
"add_x_and_y_and_z_task = wg.add_task(\n",
96-
" add_x_and_y_and_z,\n",
97-
" name='add_x_and_y_and_z',\n",
98-
" x=add_x_and_y_task.outputs.x,\n",
99-
" y=add_x_and_y_task.outputs.y,\n",
100-
" z=add_x_and_y_task.outputs.z,\n",
101-
")\n",
102-
"\n",
103-
"wg"
55+
"wg = construct_wg_simple(\n",
56+
" add_x_and_y_func=add_x_and_y, add_x_and_y_and_z_func=add_x_and_y_and_z\n",
57+
")"
10458
]
10559
},
10660
{
10761
"cell_type": "code",
108-
"execution_count": 10,
62+
"execution_count": 4,
10963
"metadata": {},
11064
"outputs": [
11165
{
@@ -125,7 +79,7 @@
12579
" {'source': 2, 'target': 3, 'sourceHandle': 'z', 'targetHandle': 'z'}]}"
12680
]
12781
},
128-
"execution_count": 10,
82+
"execution_count": 4,
12983
"metadata": {},
13084
"output_type": "execute_result"
13185
}
@@ -136,7 +90,7 @@
13690
},
13791
{
13892
"cell_type": "code",
139-
"execution_count": 11,
93+
"execution_count": 5,
14094
"metadata": {},
14195
"outputs": [],
14296
"source": [
@@ -146,29 +100,29 @@
146100
},
147101
{
148102
"cell_type": "code",
149-
"execution_count": 12,
103+
"execution_count": 6,
150104
"metadata": {},
151105
"outputs": [
152106
{
153107
"name": "stdout",
154108
"output_type": "stream",
155109
"text": [
156-
"2025-03-15 11:14:35,722 INFO Started executing jobs locally\n",
157-
"2025-03-15 11:14:35,874 INFO Starting job - add_x_and_y (0ea991be-405e-4c9f-8ac7-0c34e7b40d03)\n",
158-
"2025-03-15 11:14:35,878 INFO Finished job - add_x_and_y (0ea991be-405e-4c9f-8ac7-0c34e7b40d03)\n",
159-
"2025-03-15 11:14:35,879 INFO Starting job - add_x_and_y_and_z (0a4613e0-432b-49fe-b0cc-48a057667532)\n",
160-
"2025-03-15 11:14:35,881 INFO Finished job - add_x_and_y_and_z (0a4613e0-432b-49fe-b0cc-48a057667532)\n",
161-
"2025-03-15 11:14:35,882 INFO Finished executing jobs locally\n"
110+
"2025-03-15 11:21:45,872 INFO Started executing jobs locally\n",
111+
"2025-03-15 11:21:46,028 INFO Starting job - add_x_and_y (31bed0f7-49cd-4e63-9a53-8c9679e74dd2)\n",
112+
"2025-03-15 11:21:46,030 INFO Finished job - add_x_and_y (31bed0f7-49cd-4e63-9a53-8c9679e74dd2)\n",
113+
"2025-03-15 11:21:46,031 INFO Starting job - add_x_and_y_and_z (7d74164e-3d5b-40d0-b72b-4fc5434a98e1)\n",
114+
"2025-03-15 11:21:46,033 INFO Finished job - add_x_and_y_and_z (7d74164e-3d5b-40d0-b72b-4fc5434a98e1)\n",
115+
"2025-03-15 11:21:46,033 INFO Finished executing jobs locally\n"
162116
]
163117
},
164118
{
165119
"data": {
166120
"text/plain": [
167-
"{'0ea991be-405e-4c9f-8ac7-0c34e7b40d03': {1: Response(output={'x': 1, 'y': 2, 'z': 3}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/geiger_j/aiida_projects/adis/git-repos/python-workflow-definition'))},\n",
168-
" '0a4613e0-432b-49fe-b0cc-48a057667532': {1: Response(output=6, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/geiger_j/aiida_projects/adis/git-repos/python-workflow-definition'))}}"
121+
"{'31bed0f7-49cd-4e63-9a53-8c9679e74dd2': {1: Response(output={'x': 1, 'y': 2, 'z': 3}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/geiger_j/aiida_projects/adis/git-repos/python-workflow-definition'))},\n",
122+
" '7d74164e-3d5b-40d0-b72b-4fc5434a98e1': {1: Response(output=6, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/geiger_j/aiida_projects/adis/git-repos/python-workflow-definition'))}}"
169123
]
170124
},
171-
"execution_count": 12,
125+
"execution_count": 6,
172126
"metadata": {},
173127
"output_type": "execute_result"
174128
}

0 commit comments

Comments
 (0)