Skip to main content

Design flexible node-based workflow for AiiDA calculation.

Project description

AiiDA-WorkGraph

PyPI version Unit test codecov Docs status

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

Installation

    pip install aiida-workgraph[widget]

To install the latest version from source, first clone the repository and then install using pip:

git clone https://github.com/aiidateam/aiida-workgraph
cd aiida-workgraph
pip install -e .

To install the jupyter widget support you need to in addition build the JavaScript packages:

pip install .[widget]
# build widget
cd aiida_workgraph/widget/
npm install
npm run build
# build web frontend
cd ../../aiida_workgraph/web/frontend/
npm install
npm run build

Documentation

Explore the comprehensive documentation to discover all the features and capabilities of AiiDA Workgraph.

Demo

Visit the Workgraph Collections repository 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.

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 submit the workflow:

from aiida import load_profile

load_profile()

wg.submit(inputs = {"add1": {"x": 2, "y": 3}, "multiply1": {"y": 4}}, wait=True)
print("Result of multiply1 is", wg.tasks["multiply1"].outputs[0].value)

Start the web app, open a terminal and run:

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.

One can also generate the node graph from the process:

verdi node generate pk

Development

Pre-commit and Tests

To contribute to this repository, please enable pre-commit so the code in commits are conform to the standards.

pip install -e .[tests,pre-commit]
pre-commit install

Widget

See the README.md

Web app

See the README.md

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiida_workgraph-0.4.3.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

aiida_workgraph-0.4.3-py3-none-any.whl (6.1 MB view details)

Uploaded Python 3

File details

Details for the file aiida_workgraph-0.4.3.tar.gz.

File metadata

  • Download URL: aiida_workgraph-0.4.3.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for aiida_workgraph-0.4.3.tar.gz
Algorithm Hash digest
SHA256 7014386e3b4a06cec818d18391f36fc250490d1b89d2bcd14a8963c7d5aef598
MD5 efad14e0ad07751fbc5979623c4668d3
BLAKE2b-256 f526aa2ffe585156184d95fa2f682c79dcd638a9a09658448166529425d628c4

See more details on using hashes here.

File details

Details for the file aiida_workgraph-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for aiida_workgraph-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7f9dee041dda85d61f585eeb29a304aff2ff9690c67aaf3037c01772f869521
MD5 0ad0c7d41f054bc614bfc60b78f1c911
BLAKE2b-256 0d989d6ea08844079ca30c85546aa6735e11eb158fc2f5bb8ee857fd4ad8d1a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page