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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiida_workgraph-0.4.4.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.4.tar.gz
Algorithm Hash digest
SHA256 0b5a3c60f5dedd53e51046c07e25f85c6cf029e574575e7be98763bc49132c52
MD5 d415d36c29587bda35385bba1126dc1c
BLAKE2b-256 f8b6ef77e0a181fd9de19bfb6ac9597794e5c7e143cbe0188e9fd722ae70246d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiida_workgraph-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3db16da09657bfea15c86e95d0cdc0cee1ef224a7a10bad9a0913d4105a0c484
MD5 d06030cccd0549787917ffca53c32d27
BLAKE2b-256 14a954fa0a4530706434801cfe9c63c3024f01943d3b680983c07b2746092f6c

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