Skip to content

Commit 9fea1de

Browse files
committed
merge jobflow notebooks
1 parent aca96b1 commit 9fea1de

File tree

7 files changed

+4
-2900
lines changed

7 files changed

+4
-2900
lines changed

.github/workflows/jobflow.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,5 @@ jobs:
3333
papermill universal_simple_to_jobflow.ipynb universal_simple_to_jobflow_out.ipynb -k "python3"
3434
papermill universal_qe_to_jobflow.ipynb universal_qe_to_jobflow_out.ipynb -k "python3"
3535
36-
papermill jobflow_to_pyiron_base_simple.ipynb jobflow_to_pyiron_base_simple_out.ipynb -k "python3"
37-
papermill jobflow_to_pyiron_base_qe.ipynb jobflow_to_pyiron_base_qe_out.ipynb -k "python3"
38-
39-
papermill jobflow_to_aiida_simple.ipynb jobflow_to_aiida_simple_out.ipynb -k "python3"
40-
papermill jobflow_to_aiida_qe.ipynb jobflow_to_aiida_qe_out.ipynb -k "python3"
36+
papermill jobflow_simple.ipynb jobflow_simple_out.ipynb -k "python3"
37+
papermill jobflow_qe.ipynb jobflow_qe_out.ipynb -k "python3"

jobflow_qe.ipynb

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

jobflow_simple.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.12.8"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"982a4fbe-7cf9-45dd-84ae-9854149db0b9","cell_type":"markdown","source":"# Simple Workflow with jobflow","metadata":{}},{"id":"e6180712-d081-45c7-ba41-fc5191f10427","cell_type":"markdown","source":"## Define workflow with jobflow","metadata":{}},{"id":"000bbd4a-f53c-4eea-9d85-76f0aa2ca10b","cell_type":"code","source":"from jobflow import job, Flow","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"/srv/conda/envs/notebook/lib/python3.12/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.\n \"cipher\": algorithms.TripleDES,\n/srv/conda/envs/notebook/lib/python3.12/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.\n \"class\": algorithms.TripleDES,\n"}],"execution_count":1},{"id":"06c2bd9e-b2ac-4b88-9158-fa37331c3418","cell_type":"code","source":"from python_workflow_definition.jobflow import write_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":2},{"id":"fb847d49-7bf9-4839-9b99-c116d1b0e9ee","cell_type":"code","source":"from simple_workflow import (\n add_x_and_y as _add_x_and_y, \n add_x_and_y_and_z as _add_x_and_y_and_z,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"8f95244e","cell_type":"code","source":"workflow_json_filename = \"jobflow_simple.json\"","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"07598344-0f75-433b-8902-bea21a42088c","cell_type":"code","source":"add_x_and_y = job(_add_x_and_y, data=[\"x\", \"y\", \"z\"])\nadd_x_and_y_and_z = job(_add_x_and_y_and_z)","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"ecef1ed5-a8d3-48c3-9e01-4a40e55c1153","cell_type":"code","source":"obj = add_x_and_y(x=1, y=2)","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"2b88a30a-e26b-4802-89b7-79ca08cc0af9","cell_type":"code","source":"w = add_x_and_y_and_z(x=obj.output.x, y=obj.output.y, z=obj.output.z)","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"a5e5ca63-2906-47c9-bac6-adebf8643cba","cell_type":"code","source":"flow = Flow([obj, w])","metadata":{"trusted":true},"outputs":[],"execution_count":8},{"id":"e464da97-16a1-4772-9a07-0a47f152781d","cell_type":"code","source":"write_workflow_json(flow=flow, file_name=workflow_json_filename)","metadata":{"trusted":true},"outputs":[],"execution_count":9},{"id":"bca646b2-0a9a-4271-966a-e5903a8c9031","cell_type":"code","source":"!cat {workflow_json_filename}","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"{\"nodes\": {\"0\": \"simple_workflow.add_x_and_y\", \"1\": \"simple_workflow.add_x_and_y_and_z\", \"2\": 1, \"3\": 2}, \"edges\": [{\"target\": 0, \"targetHandle\": \"x\", \"source\": 2, \"sourceHandle\": null}, {\"target\": 0, \"targetHandle\": \"y\", \"source\": 3, \"sourceHandle\": null}, {\"target\": 1, \"targetHandle\": \"x\", \"source\": 0, \"sourceHandle\": \"x\"}, {\"target\": 1, \"targetHandle\": \"y\", \"source\": 0, \"sourceHandle\": \"y\"}, {\"target\": 1, \"targetHandle\": \"z\", \"source\": 0, \"sourceHandle\": \"z\"}]}"}],"execution_count":10},{"id":"87a27540-c390-4d34-ae75-4739bfc4c1b7","cell_type":"markdown","source":"## Load Workflow with aiida","metadata":{}},{"id":"66a1b3a6-3d3b-4caa-b58f-d8bc089b1074","cell_type":"code","source":"from aiida import load_profile\n\nload_profile()","metadata":{"trusted":true},"outputs":[{"execution_count":11,"output_type":"execute_result","data":{"text/plain":"Profile<uuid='c42e9c9e33c74bf98d1b7929313a2856' name='adis'>"},"metadata":{}}],"execution_count":11},{"id":"4679693b-039b-45cf-8c67-5b2b3d705a83","cell_type":"code","source":"from python_workflow_definition.aiida import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":12},{"id":"68c41a61-d185-47e8-ba31-eeff71d8b2c6","cell_type":"code","source":"wg = load_workflow_json(file_name=workflow_json_filename)\nwg","metadata":{"trusted":true},"outputs":[{"execution_count":13,"output_type":"execute_result","data":{"text/plain":"NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'WorkGra…","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":1,"model_id":"b4247ecf627d478b90b979bbdbaefbd3"}},"metadata":{}}],"execution_count":13},{"id":"05228ece-643c-420c-8df8-4ce3df379515","cell_type":"code","source":"wg.run()","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"03/22/2025 09:10:55 AM <674> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [31|WorkGraphEngine|continue_workgraph]: Continue workgraph.\n03/22/2025 09:10:55 AM <674> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [31|WorkGraphEngine|continue_workgraph]: tasks ready to run: pickle_node3,pickle_node4\n03/22/2025 09:10:55 AM <674> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [31|WorkGraphEngine|run_tasks]: Run task: pickle_node3, type: PYTHONJOB\n"},{"name":"stdout","output_type":"stream","text":"------------------------------------------------------------\nkwargs: {'value': 1}\n"},{"name":"stderr","output_type":"stream","text":"03/22/2025 09:10:56 AM <674> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [31|WorkGraphEngine|run_tasks]: Run task: pickle_node4, type: PYTHONJOB\n"},{"name":"stdout","output_type":"stream","text":"------------------------------------------------------------\nkwargs: {'value': 2}\n"},{"name":"stderr","output_type":"stream","text":"03/22/2025 09:10:56 AM <674> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [31|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 39, 47\n03/22/2025 09:10:59 AM <674> aiida.scheduler.direct: [WARNING] Unrecognized job_state 'p' for job id Activating\n03/22/2025 09:10:59 AM <674> aiida.engine.transports: [ERROR] Exception whilst using transport:\nTraceback (most recent call last):\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/transports.py\", line 106, in request_transport\n yield transport_request.future\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 109, in _get_jobs_from_scheduler\n scheduler_response = scheduler.get_jobs(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 269, in get_jobs\n job_stats = super().get_jobs(jobs=jobs, user=user, as_dict=as_dict)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/scheduler.py\", line 361, in get_jobs\n joblist = self._parse_joblist_output(retval, stdout, stderr)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 253, in _parse_joblist_output\n this_job.wallclock_time_seconds = self._convert_time(job[3])\n ~~~^^^\nIndexError: list index out of range\n\nTask exception was never retrieved\nfuture: <Task finished name='Task-10' coro=<JobsList._ensure_updating.<locals>.updating() done, defined at /srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py:179> exception=IndexError('list index out of range')>\nTraceback (most recent call last):\n File \"/srv/conda/envs/notebook/lib/python3.12/asyncio/tasks.py\", line 314, in __step_run_and_handle_result\n result = coro.send(None)\n ^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 181, in updating\n await self._update_job_info()\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 132, in _update_job_info\n self._jobs_cache = await self._get_jobs_from_scheduler()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 109, in _get_jobs_from_scheduler\n scheduler_response = scheduler.get_jobs(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 269, in get_jobs\n job_stats = super().get_jobs(jobs=jobs, user=user, as_dict=as_dict)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/scheduler.py\", line 361, in get_jobs\n joblist = self._parse_joblist_output(retval, stdout, stderr)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 253, in _parse_joblist_output\n this_job.wallclock_time_seconds = self._convert_time(job[3])\n ~~~^^^\nIndexError: list index out of range\n03/22/2025 09:10:59 AM <674> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [ERROR] iteration 1 of do_update excepted, retrying after 20 seconds\nTraceback (most recent call last):\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/utils.py\", line 205, in exponential_backoff_retry\n result = await coro()\n ^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/tasks.py\", line 195, in do_update\n job_info = await cancellable.with_interrupt(update_request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/utils.py\", line 115, in with_interrupt\n result = await next(wait_iter)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/asyncio/tasks.py\", line 631, in _wait_for_one\n return f.result() # May raise f.exception().\n ^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/asyncio/futures.py\", line 202, in result\n raise self._exception.with_traceback(self._exception_tb)\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 132, in _update_job_info\n self._jobs_cache = await self._get_jobs_from_scheduler()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 109, in _get_jobs_from_scheduler\n scheduler_response = scheduler.get_jobs(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 269, in get_jobs\n job_stats = super().get_jobs(jobs=jobs, user=user, as_dict=as_dict)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/scheduler.py\", line 361, in get_jobs\n joblist = self._parse_joblist_output(retval, stdout, stderr)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 253, in _parse_joblist_output\n this_job.wallclock_time_seconds = self._convert_time(job[3])\n ~~~^^^\nIndexError: list index out of range\n03/22/2025 09:10:59 AM <674> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [ERROR] iteration 1 of do_update excepted, retrying after 20 seconds\nTraceback (most recent call last):\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/utils.py\", line 205, in exponential_backoff_retry\n result = await coro()\n ^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/tasks.py\", line 195, in do_update\n job_info = await cancellable.with_interrupt(update_request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/utils.py\", line 115, in with_interrupt\n result = await next(wait_iter)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/asyncio/tasks.py\", line 631, in _wait_for_one\n return f.result() # May raise f.exception().\n ^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/asyncio/futures.py\", line 202, in result\n raise self._exception.with_traceback(self._exception_tb)\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 132, in _update_job_info\n self._jobs_cache = await self._get_jobs_from_scheduler()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/manager.py\", line 109, in _get_jobs_from_scheduler\n scheduler_response = scheduler.get_jobs(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 269, in get_jobs\n job_stats = super().get_jobs(jobs=jobs, user=user, as_dict=as_dict)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/scheduler.py\", line 361, in get_jobs\n joblist = self._parse_joblist_output(retval, stdout, stderr)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida/schedulers/plugins/direct.py\", line 253, in _parse_joblist_output\n this_job.wallclock_time_seconds = self._convert_time(job[3])\n ~~~^^^\nIndexError: list index out of range\n"}],"execution_count":null},{"id":"2c942094-61b4-4e94-859a-64f87b5bec64","cell_type":"markdown","source":"## Load Workflow with pyiron_base","metadata":{}},{"id":"40672826-23bf-4c24-84e2-a6b9d87e2a3f","cell_type":"code","source":"from pyiron_base import Project","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"ea102341-84f7-4156-a7d1-c3ab1ea613a5","cell_type":"code","source":"from python_workflow_definition.pyiron_base import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"f45684a8-2613-415a-ab0a-5cb2bafaffea","cell_type":"code","source":"pr = Project(\"test\")\npr.remove_jobs(recursive=True, silently=True)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"8f2a621d-b533-4ddd-8bcd-c22db2f922ec","cell_type":"code","source":"delayed_object = load_workflow_json(project=pr, file_name=workflow_json_filename)\ndelayed_object.draw()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"cf80267d-c2b0-4236-bf1d-a57596985fc1","cell_type":"code","source":"delayed_object.pull()","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}

0 commit comments

Comments
 (0)