Skip to main content

AiiDA-WorkGraph

PyPI version Unit test codecov Docs status

A powerful Python library for creating, managing, and executing scalable scientific workflows with automatic data provenance.


✨ Why AiiDA-WorkGraph?

AiiDA-WorkGraph empowers researchers and developers to build complex, reproducible workflows with ease.

  • 🎨 Pythonic Workflow Design: Define workflows using familiar Python functions and decorators.
  • 🖥️ Interactive GUI: Visualize, monitor, and debug your workflows in real-time with a user-friendly web interface.
  • 🔗 Automatic Data Provenance: Guarantee scientific reproducibility with zero effort. The complete history of all data and calculations is automatically tracked.
  • 🚀 Remote & Parallel Execution: Seamlessly offload tasks to remote supercomputers and run them concurrently.
  • 🧠 Dynamic Control Flow: Build adaptive workflows that respond to data at runtime using standard Python if/else statements and loops.
  • 🛡️ Checkpointing & Error Handling: Protect long-running workflows from interruptions and build resilient logic to recover from failures.
  • ⚡ High-Throughput Computing: Built to scale, AiiDA-WorkGraph can efficiently manage thousands of concurrent workflows.
  • 🧩 Reusable Components: Encapsulate common routines as sub-workflows and easily reuse them in larger, more complex pipelines.

🚀 Getting Started

1. Installation

pip install aiida-workgraph

First, ensure you have a working AiiDA environment.

verdi presto  # Or 'verdi quicksetup' for a detailed setup

2. Quick Start Example

Let's create a simple workflow to calculate $(x + y) \times z$.

1️⃣ Define Tasks

Use the @task decorator to turn Python functions into workflow components.

from aiida_workgraph import task

@task
def add(x, y):
    """Adds two numbers."""
    return x + y

@task
def multiply(x, y):
    """Multiplies two numbers."""
    return x * y

2️⃣ Compose a Workflow

Use the @task.graph decorator to link tasks. Data flows naturally from one task's output to the next one's input.

@task.graph
def add_multiply(x, y, z):
    """A workflow to add two numbers and then multiply by a third."""
    sum_result = add(x, y).result
    product_result = multiply(x=sum_result, y=z).result
    return product_result

3️⃣ Run the Workflow

Build the workflow with your inputs and run it.

from aiida import load_profile

# Load your AiiDA profile
load_profile()

# Build and run the workflow
results = add_multiply.run(x=2, y=3, z=4)

# Print the final result
print(f"✅ Result: {results}")
# Expected output: ✅ Result: 20

4️⃣ Automatic Provenance Tracking

AiiDA-WorkGraph automatically generates a detailed provenance graph, tracking the full history of data and calculations to ensure full traceability and reproducibility. Here is an example of the provenance graph generated for the above workflow:

Provenance Graph Example


🛠️ Flexible Workflow Construction

AiiDA-WorkGraph supports three complementary approaches to building workflows, letting you choose the best method for your needs.

  • 🐍 Pythonic Workflows (Recommended): Use @task.graph for clean, readable, and powerful workflows, as shown in the Quick Start.

  • 👁️ Visual Graph with Explicit Logic: Use zones like If, While, and Map to build a graph where the control flow is visually explicit.

  • ⚙️ Low-Level Node-Graph Programming: Programmatically define each task and link them manually for maximum control and dynamic graph generation.


🖥️ Interactive GUI

Visualize, monitor, and debug your workflows in real-time. To launch the GUI, first install the package and then run:

pip install aiida-gui-workgraph
aiida-gui start

Navigate to http://127.0.0.1:8000/workgraph in your web browser.

AiiDA-WorkGraph Web UI

Note: The GUI is an experimental feature and is under active development.


🔗 Useful Links

Metadata

Release files for aiida-workgraph 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiida-workgraph 0.9.0
File Size Uploaded
aiida_workgraph-0.9.0.tar.gz 70.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiida-workgraph 0.9.0
File Interpreter ABI Platform
aiida_workgraph-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 158.7 kB

Release files / aiida_workgraph-0.9.0.tar.gz

Download URL aiida_workgraph-0.9.0.tar.gz
Size 70.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5ea282fad9506171e5baf4e00b26b7f73f92b542cd3d94b138b196e4add79159
BLAKE2b-256 checksum
How to use checksums
7b345d2da34e75081921d6e0123ec0d5d2aeba9a7377cc1c8dd7338ac789a87c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / aiida_workgraph-0.9.0-py3-none-any.whl

Download URL aiida_workgraph-0.9.0-py3-none-any.whl
Size 87.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06d78420f046bcaf300a1d4823787ccfc586bccb54acc2f151473bb842e37967
BLAKE2b-256 checksum
How to use checksums
131cd6a8c8911168804367ef99ea4e82747b7a0bbf446a69f9d800920aea00bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.26

2 release files

0.3.25

2 release files

0.3.24

2 release files

0.3.23

2 release files

0.3.22

2 release files

0.3.21

2 release files

0.3.20

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.17

2 release files

0.3.16

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page