Skip to content

Commit b82b4a6

Browse files
committed
Add readme
1 parent 8efcd8e commit b82b4a6

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Python Workflow Definition
2+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyiron-dev/python-workflow-definition/HEAD)
3+
4+
## Definition
5+
In the Python Workflow Definition (PWD) each node represents a Python function, with the edges defining the connection
6+
between input and output of the different Python functions.
7+
8+
## Format
9+
Each workflow consists of three files, a Python module which defines the individual Pythons, a JSON file which defines
10+
the connections between the different Python functions and a conda environment file to define the software dependencies.
11+
The files are not intended to be human readable, but rather interact as a machine readable exchange format between the
12+
different workflow engines to enable interoperability.
13+
14+
## Examples
15+
### Simple Example
16+
As a first example we define two Python functions which add multiple inputs:
17+
```python
18+
def add_x_and_y(x, y):
19+
z = x + y
20+
return x, y, z
21+
22+
def add_x_and_y_and_z(x, y, z):
23+
w = x + y + z
24+
return w
25+
```
26+
These two Python functions are combined in the following example workflow:
27+
```python
28+
x, y, z = add_x_and_y(x=1, y=2)
29+
w = add_x_and_y_and_z(x=x, y=y, z=z)
30+
```
31+
For the workflow representation of these Python functions the Python functions are stored in the [simple_workflow.py](simple_workflow.py)
32+
Python module. The connection of the Python functions are stored in the [workflow_simple.json](workflow_simple.json)
33+
JSON file:
34+
```
35+
{
36+
"nodes": {
37+
"0": "simple_workflow.add_x_and_y_and_z",
38+
"1": "simple_workflow.add_x_and_y",
39+
"2": "simple_workflow.add_x_and_y",
40+
"3": "simple_workflow.add_x_and_y",
41+
"4": 1,
42+
"5": 2
43+
},
44+
"edges": [
45+
{"target": 0, "targetHandle": "x", "source": 1, "sourceHandle": "x"},
46+
{"target": 1, "targetHandle": "x", "source": 4, "sourceHandle": null},
47+
{"target": 1, "targetHandle": "y", "source": 5, "sourceHandle": null},
48+
{"target": 0, "targetHandle": "y", "source": 2, "sourceHandle": "y"},
49+
{"target": 2, "targetHandle": "x", "source": 4, "sourceHandle": null},
50+
{"target": 2, "targetHandle": "y", "source": 5, "sourceHandle": null},
51+
{"target": 0, "targetHandle": "z", "source": 3, "sourceHandle": "z"},
52+
{"target": 3, "targetHandle": "x", "source": 4, "sourceHandle": null},
53+
{"target": 3, "targetHandle": "y", "source": 5, "sourceHandle": null}
54+
]
55+
}
56+
```
57+
As the workflow does not require any additional resources, the `environment.yml` file is not required.
58+
59+
The corresponding Jupyter notebooks demonstrate this functionality:
60+
61+
| Example | Explanation |
62+
|--------------------------------------------------------------------------------|------------------------------------------------------------------------------|
63+
| [universal_simple_to_jobflow.ipynb](universal_simple_to_jobflow.ipynb) | Execute workflow defined in the Python Workflow Definition with jobflow. |
64+
| [universal_simple_to_pyiron_base.ipynb](universal_simple_to_pyiron_base.ipynb) | Execute workflow defined in the Python Workflow Definition with pyrion_base. |
65+
| [jobflow_to_pyiron_base_simple.ipynb](jobflow_to_pyiron_base_simple.ipynb) | Define Workflow with jobflow and execute it with pyiron_base. |
66+
| [pyiron_base_to_jobflow_simple.ipynb](pyiron_base_to_jobflow_simple.ipynb) | Define Workflow with pyiron_base and execute it with jobflow. |
67+
68+
### Quantum Espresso Workflow
69+
The second workflow example is the calculation of an energy volume curve with Quantum Espresso. In the first step the
70+
initial structure is relaxed, afterwards it is strained and the total energy is calculated.
71+
* [quantum_espresso_workflow.py](quantum_espresso_workflow.py) Python functions
72+
* [workflow_qe.json](workflow_qe.json) Workflow definition in the Python Workflow Definition.
73+
* [environment.yml](environment.yml) Conda environment
74+
75+
| Example | Explanation |
76+
|------------------------------------------------------------------------|------------------------------------------------------------------------------|
77+
| [universal_qe_to_jobflow.ipynb](universal_qe_to_jobflow.ipynb) | Execute workflow defined in the Python Workflow Definition with jobflow. |
78+
| [universal_qe_to_pyiron_base.ipynb](universal_qe_to_pyiron_base.ipynb) | Execute workflow defined in the Python Workflow Definition with pyrion_base. |
79+
| [jobflow_to_pyiron_base_qe.ipynb](jobflow_to_pyiron_base_qe.ipynb) | Define Workflow with jobflow and execute it with pyiron_base. |
80+
| [pyiron_base_to_jobflow_qe.ipynb](pyiron_base_to_jobflow_qe.ipynb) | Define Workflow with pyiron_base and execute it with jobflow. |

0 commit comments

Comments
 (0)