Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.
pip install aiida-workgraph
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 .
Explore the comprehensive documentation to discover all the features and capabilities of AiiDA Workgraph.
Visit the Workgraph Collections repository to see demonstrations of how to utilize AiiDA Workgraph for different computational codes.
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)
To use the web ui, first install the web ui package:
pip install aiida-workgraph-web-ui
Then, start the web app with the following command:
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
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