Name | aiida-workgraph JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Design flexible node-based workflow for AiiDA calculation. |
upload_time | 2024-04-19 15:21:18 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
aiida
workflows
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# AiiDA-WorkGraph
[![PyPI version](https://badge.fury.io/py/aiida-workgraph.svg)](https://badge.fury.io/py/aiida-workgraph)
[![Unit test](https://github.com/superstar54/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/superstar54/aiida-workgraph/actions/workflows/ci.yaml)
[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)
Provides the third workflow component: `WorkGraph`, to design flexible node-based workflows using AiiDA.
In AiiDA, there are two workflow components: `workfunction` and `WorkChain`. Workfunction is easy to implement but it does not support automatic checkpointing, which is important for long-running calculations. Workchain supports automatic checkpointing but it is difficult to implement and also not as flexible as the `workfunction`. AiiDA-WorkGraph provides the third component: `WorkGraph`. It is easy to implement and supports automatic checkpointing. It is also flexible and can be used to design complex workflows.
Here is a detailed comparison between the ``WorkGraph`` with two AiiDA built-in workflow components.
| Aspect | WorkFunction | WorkChain | WorkGraph |
| ------------------------ | ---------------------- | ----------------------------- | ---------------------- |
| Use Case | Short-running jobs | Long-running jobs | Long-running jobs |
| Checkpointing | ``No`` | Yes | Yes |
| Execution order | ``Sequential`` | ``Hybrid Sequential-Parallel``| Directed Acyclic Graph |
| Non-blocking | ``No`` | Yes | Yes |
| Implementation | Easy | ``Difficult`` | Easy |
| Dynamic | ``No`` | ``No`` | Yes |
| Ready to Use | Yes | ``Need PYTHONPATH`` | Yes |
| Subprocesses Handling | ``No`` | Launches & waits | Launches & waits |
| Flow Control | All | `if`, `while` | `if`, `while`, `match` |
| Termination | ``Hard exit`` | ExitCode | ExitCode |
| Data Passing | Direct passing | Context | Link & Context |
| Output Recording | Limited support | Out & validates | Out |
| Port Exposing | Limited support | Manual & automatic | Manual |
## Installation
```console
pip install aiida-workgraph
```
To install the latest version from source, first clone the repository and then install using `pip`:
```console
git clone https://github.com/superstar54/aiida-workgraph
cd aiida-workgraph
pip install -e .
```
In order to use the widget, you also need to run:
```console
cd aiida_workgraph/widget/
npm install
npm run build
```
## Documentation
Check the [docs](https://aiida-workgraph.readthedocs.io/en/latest/) and learn about the features.
## Examples
Create calcfunction nodes:
```python
from aiida_workgraph import node
# define add calcfunction node
@node.calcfunction()
def add(x, y):
return x + y
# define multiply calcfunction node
@node.calcfunction()
def multiply(x, y):
return x*y
```
Create a workgraph to link the nodes.
```python
from aiida_workgraph import WorkGraph
from aiida import load_profile
from aiida.orm import Int
load_profile()
wg = WorkGraph("test_add_multiply")
wg.nodes.new(add, name="add1", x=Int(2.0), y=Int(3.0))
wg.nodes.new(multiply, name="multiply1", y=Int(4.0))
wg.links.new(wg.nodes["add1"].outputs[0], wg.nodes["multiply1"].inputs["x"])
wg.submit(wait=True)
```
Start the web app, open a terminal and run:
```console
workgraph web start
```
Then visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` Worktree, click the pk and view the WorkGraph.
<img src="docs/source/_static/images/first-workflow.png" />
One can also generate the node graph from the process:
```console
verdi node generate pk
```
<img src="docs/source/_static/images/add_multiply.png"/>
## Development
### Pre-commit and Tests
To contribute to this repository, please enable pre-commit so the code in commits are conform to the standards.
```console
pip install -e .[tests, pre-commit]
pre-commit install
```
### Web app
See the [README.md](https://github.com/superstar54/aiida-workgraph/blob/main/aiida_workgraph/web/README.md)
### Build and publish
Build package:
```console
pip install build
python -m build
```
Upload to PyPI:
```console
pip install twine
twine upload dist/*
```
## License
[MIT](http://opensource.org/licenses/MIT)
Raw data
{
"_id": null,
"home_page": null,
"name": "aiida-workgraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "aiida, workflows",
"author": null,
"author_email": "Xing Wang <xingwang1991@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/40/2f/cf1044ca7f397322ea2efc39aed99d39391a6ddbd4a0290cf8ee2136d1d5/aiida_workgraph-0.2.0.tar.gz",
"platform": null,
"description": "# AiiDA-WorkGraph\n[![PyPI version](https://badge.fury.io/py/aiida-workgraph.svg)](https://badge.fury.io/py/aiida-workgraph)\n[![Unit test](https://github.com/superstar54/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/superstar54/aiida-workgraph/actions/workflows/ci.yaml)\n[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)\n\nProvides the third workflow component: `WorkGraph`, to design flexible node-based workflows using AiiDA.\n\nIn AiiDA, there are two workflow components: `workfunction` and `WorkChain`. Workfunction is easy to implement but it does not support automatic checkpointing, which is important for long-running calculations. Workchain supports automatic checkpointing but it is difficult to implement and also not as flexible as the `workfunction`. AiiDA-WorkGraph provides the third component: `WorkGraph`. It is easy to implement and supports automatic checkpointing. It is also flexible and can be used to design complex workflows.\n\n\nHere is a detailed comparison between the ``WorkGraph`` with two AiiDA built-in workflow components.\n\n\n| Aspect | WorkFunction | WorkChain | WorkGraph |\n| ------------------------ | ---------------------- | ----------------------------- | ---------------------- |\n| Use Case | Short-running jobs | Long-running jobs | Long-running jobs |\n| Checkpointing | ``No`` | Yes | Yes |\n| Execution order | ``Sequential`` | ``Hybrid Sequential-Parallel``| Directed Acyclic Graph |\n| Non-blocking | ``No`` | Yes | Yes |\n| Implementation | Easy | ``Difficult`` | Easy |\n| Dynamic | ``No`` | ``No`` | Yes |\n| Ready to Use | Yes | ``Need PYTHONPATH`` | Yes |\n| Subprocesses Handling | ``No`` | Launches & waits | Launches & waits |\n| Flow Control | All | `if`, `while` | `if`, `while`, `match` |\n| Termination | ``Hard exit`` | ExitCode | ExitCode |\n| Data Passing | Direct passing | Context | Link & Context |\n| Output Recording | Limited support | Out & validates | Out |\n| Port Exposing | Limited support | Manual & automatic | Manual |\n\n\n\n## Installation\n\n```console\n pip install aiida-workgraph\n```\n\nTo install the latest version from source, first clone the repository and then install using `pip`:\n\n```console\ngit clone https://github.com/superstar54/aiida-workgraph\ncd aiida-workgraph\npip install -e .\n```\nIn order to use the widget, you also need to run:\n```console\ncd aiida_workgraph/widget/\nnpm install\nnpm run build\n```\n\n## Documentation\nCheck the [docs](https://aiida-workgraph.readthedocs.io/en/latest/) and learn about the features.\n\n## Examples\n\nCreate calcfunction nodes:\n\n```python\nfrom aiida_workgraph import node\n\n# define add calcfunction node\n@node.calcfunction()\ndef add(x, y):\n return x + y\n\n# define multiply calcfunction node\n@node.calcfunction()\ndef multiply(x, y):\n return x*y\n\n```\n\nCreate a workgraph to link the nodes.\n\n```python\nfrom aiida_workgraph import WorkGraph\nfrom aiida import load_profile\nfrom aiida.orm import Int\nload_profile()\n\n\nwg = WorkGraph(\"test_add_multiply\")\nwg.nodes.new(add, name=\"add1\", x=Int(2.0), y=Int(3.0))\nwg.nodes.new(multiply, name=\"multiply1\", y=Int(4.0))\nwg.links.new(wg.nodes[\"add1\"].outputs[0], wg.nodes[\"multiply1\"].inputs[\"x\"])\nwg.submit(wait=True)\n```\n\nStart the web app, open a terminal and run:\n```console\nworkgraph web start\n```\n\nThen visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` Worktree, click the pk and view the WorkGraph.\n\n<img src=\"docs/source/_static/images/first-workflow.png\" />\n\n\nOne can also generate the node graph from the process:\n```console\nverdi node generate pk\n```\n\n<img src=\"docs/source/_static/images/add_multiply.png\"/>\n\n\n## Development\n\n### Pre-commit and Tests\nTo contribute to this repository, please enable pre-commit so the code in commits are conform to the standards.\n```console\npip install -e .[tests, pre-commit]\npre-commit install\n```\n\n### Web app\nSee the [README.md](https://github.com/superstar54/aiida-workgraph/blob/main/aiida_workgraph/web/README.md)\n\n### Build and publish\nBuild package:\n```console\npip install build\npython -m build\n```\nUpload to PyPI:\n```console\npip install twine\ntwine upload dist/*\n```\n\n## License\n[MIT](http://opensource.org/licenses/MIT)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Design flexible node-based workflow for AiiDA calculation.",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://aiida-workgraph.readthedocs.io",
"Source": "https://github.com/superstart54/aiida-workgraph"
},
"split_keywords": [
"aiida",
" workflows"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8fe60b843012a49011834438279bbd474e971ad7bb5a03653582893e3374abed",
"md5": "2a78c833b6aeda9e2b09d51c3539e4b0",
"sha256": "8cae020e20d50d185c42739f9dc14ca4bb4404d5128bfef88df0abe4fff1c8d1"
},
"downloads": -1,
"filename": "aiida_workgraph-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2a78c833b6aeda9e2b09d51c3539e4b0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5772790,
"upload_time": "2024-04-19T15:21:16",
"upload_time_iso_8601": "2024-04-19T15:21:16.030271Z",
"url": "https://files.pythonhosted.org/packages/8f/e6/0b843012a49011834438279bbd474e971ad7bb5a03653582893e3374abed/aiida_workgraph-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "402fcf1044ca7f397322ea2efc39aed99d39391a6ddbd4a0290cf8ee2136d1d5",
"md5": "fa9c6a08c30cb658f4155d4ad0ec0437",
"sha256": "e8fdf19672c2898e6dd8b3d6b43e18a65017787887115d3fc483688bf69055ce"
},
"downloads": -1,
"filename": "aiida_workgraph-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "fa9c6a08c30cb658f4155d4ad0ec0437",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5689846,
"upload_time": "2024-04-19T15:21:18",
"upload_time_iso_8601": "2024-04-19T15:21:18.946816Z",
"url": "https://files.pythonhosted.org/packages/40/2f/cf1044ca7f397322ea2efc39aed99d39391a6ddbd4a0290cf8ee2136d1d5/aiida_workgraph-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-19 15:21:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "superstart54",
"github_project": "aiida-workgraph",
"github_not_found": true,
"lcname": "aiida-workgraph"
}