aiida-workgraph


Nameaiida-workgraph JSON
Version 0.4.10 PyPI version JSON
download
home_pageNone
SummaryDesign flexible node-based workflow for AiiDA calculation.
upload_time2024-12-13 10:42:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
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/aiidateam/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/aiidateam/aiida-workgraph/branch/main/graph/badge.svg)](https://codecov.io/gh/aiidateam/aiida-workgraph)
[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.



## 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/aiidateam/aiida-workgraph
cd aiida-workgraph
pip install -e .
```


## Documentation
Explore the comprehensive [documentation](https://aiida-workgraph.readthedocs.io/en/latest/) to discover all the features and capabilities of AiiDA Workgraph.

## Demo
Visit the [Workgraph Collections repository](https://github.com/superstar54/workgraph-collections) to see demonstrations of how to utilize AiiDA Workgraph for different computational codes.

## Examples
Suppose we want to calculate ```(x + y) * z ``` in two steps. First, add `x` and `y`, then multiply the result with `z`.

```python
from aiida_workgraph import WorkGraph, task

# define add task
@task.calcfunction
def add(x, y):
    return x + y

# define multiply task
@task.calcfunction
def multiply(x, y):
    return x*y

# Create a workgraph to link the tasks.
wg = WorkGraph("test_add_multiply")
wg.add_task(add, name="add1")
wg.add_task(multiply, name="multiply1")
wg.add_link(wg.tasks.add1.outputs.result, wg.tasks.multiply1.inputs.x)

```

Prepare inputs and run the workflow:

```python
from aiida import load_profile

load_profile()

wg.run(inputs = {"add1": {"x": 2, "y": 3}, "multiply1": {"y": 4}})
print("Result of multiply1 is", wg.tasks.multiply1.outputs.result.value)
```
## Web ui
To use the web ui, first install the web ui package:
```console
pip install aiida-workgraph-web-ui
```
Then, start the web app with the following command:
```console

workgraph web start
```

Then visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` WorkGraph, 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
```

## 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/76/57/133c3f18fff9ca8c3d9d3464495c59d4577d5b7a5bf29258f9afd0b68c07/aiida_workgraph-0.4.10.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/aiidateam/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml)\n[![codecov](https://codecov.io/gh/aiidateam/aiida-workgraph/branch/main/graph/badge.svg)](https://codecov.io/gh/aiidateam/aiida-workgraph)\n[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)\n\nEfficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.\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/aiidateam/aiida-workgraph\ncd aiida-workgraph\npip install -e .\n```\n\n\n## Documentation\nExplore the comprehensive [documentation](https://aiida-workgraph.readthedocs.io/en/latest/) to discover all the features and capabilities of AiiDA Workgraph.\n\n## Demo\nVisit the [Workgraph Collections repository](https://github.com/superstar54/workgraph-collections) to see demonstrations of how to utilize AiiDA Workgraph for different computational codes.\n\n## Examples\nSuppose we want to calculate ```(x + y) * z ``` in two steps. First, add `x` and `y`, then multiply the result with `z`.\n\n```python\nfrom aiida_workgraph import WorkGraph, task\n\n# define add task\n@task.calcfunction\ndef add(x, y):\n    return x + y\n\n# define multiply task\n@task.calcfunction\ndef multiply(x, y):\n    return x*y\n\n# Create a workgraph to link the tasks.\nwg = WorkGraph(\"test_add_multiply\")\nwg.add_task(add, name=\"add1\")\nwg.add_task(multiply, name=\"multiply1\")\nwg.add_link(wg.tasks.add1.outputs.result, wg.tasks.multiply1.inputs.x)\n\n```\n\nPrepare inputs and run the workflow:\n\n```python\nfrom aiida import load_profile\n\nload_profile()\n\nwg.run(inputs = {\"add1\": {\"x\": 2, \"y\": 3}, \"multiply1\": {\"y\": 4}})\nprint(\"Result of multiply1 is\", wg.tasks.multiply1.outputs.result.value)\n```\n## Web ui\nTo use the web ui, first install the web ui package:\n```console\npip install aiida-workgraph-web-ui\n```\nThen, start the web app with the following command:\n```console\n\nworkgraph web start\n```\n\nThen visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` WorkGraph, 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## 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.4.10",
    "project_urls": {
        "Documentation": "https://aiida-workgraph.readthedocs.io",
        "Source": "https://github.com/aiidateam/aiida-workgraph"
    },
    "split_keywords": [
        "aiida",
        " workflows"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bfedf16830f9e8e289802737d7fdf1e02b67875590e48451a18e6e8af01345e0",
                "md5": "5980c48622430df2df28c2b9dec8e8ac",
                "sha256": "73758fb53c8d164806802d28338e00f70c90f4e552c6fd95b9d79d299dd4c7f2"
            },
            "downloads": -1,
            "filename": "aiida_workgraph-0.4.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5980c48622430df2df28c2b9dec8e8ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 76604,
            "upload_time": "2024-12-13T10:42:29",
            "upload_time_iso_8601": "2024-12-13T10:42:29.703150Z",
            "url": "https://files.pythonhosted.org/packages/bf/ed/f16830f9e8e289802737d7fdf1e02b67875590e48451a18e6e8af01345e0/aiida_workgraph-0.4.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7657133c3f18fff9ca8c3d9d3464495c59d4577d5b7a5bf29258f9afd0b68c07",
                "md5": "fc49a0a4f65da960c8935dc76d2555dd",
                "sha256": "a00f208cd2fe26d02a8ddff74bd8c7a9accee85666964c148f8fadeb1321a6dc"
            },
            "downloads": -1,
            "filename": "aiida_workgraph-0.4.10.tar.gz",
            "has_sig": false,
            "md5_digest": "fc49a0a4f65da960c8935dc76d2555dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 61071,
            "upload_time": "2024-12-13T10:42:32",
            "upload_time_iso_8601": "2024-12-13T10:42:32.882099Z",
            "url": "https://files.pythonhosted.org/packages/76/57/133c3f18fff9ca8c3d9d3464495c59d4577d5b7a5bf29258f9afd0b68c07/aiida_workgraph-0.4.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-13 10:42:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aiidateam",
    "github_project": "aiida-workgraph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiida-workgraph"
}
        
Elapsed time: 0.56721s