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.5.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiida_workgraph-0.4.5.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.5.tar.gz
Algorithm Hash digest
SHA256 117a1092b1eba0793bc15ea8ab4d52667e7435424fde14402c2c444a24ad6fa6
MD5 d4da6318e8ad2d055fe38f880a61b8e6
BLAKE2b-256 bce55370b7318777c10ddf9369fba87b42b4b43db01b931da9e45077eb07fc85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiida_workgraph-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d3a89101607d823a9a3be57ad0c16d42bef5fd8eac200d554704d2a8c8590b7a
MD5 dbc83782e421d95e4ccb614d05e64747
BLAKE2b-256 77498c520dd87e757afa48445a8445f73b514dd6c1ae848c5e9e343e135b8078

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