Skip to content

Commit

Permalink
Update README, and fix/web executor (aiidateam#306)
Browse files Browse the repository at this point in the history
* Update readme
* fix executor's source code in the web app
  • Loading branch information
superstar54 authored and GeigerJ2 committed Sep 13, 2024
1 parent 7909c17 commit 30179fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
36 changes: 7 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,14 @@
[![codecov](https://codecov.io/gh/superstar54/aiida-workgraph/branch/main/graph/badge.svg)](https://codecov.io/gh/superstar54/aiida-workgraph)
[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)

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



Here is a detailed comparison between the ``WorkGraph`` with two AiiDA built-in workflow components.


| Aspect | WorkFunction | WorkChain | WorkGraph |
| ------------------------ | ---------------------- | ----------------------------- | ---------------------- |
| Use Case | Short-running jobs | Long-running jobs | Long-running jobs |
| Checkpointing | ``No`` | Yes | Yes |
| Execution order | ``Sequential`` | ``Hybrid Sequential-Parallel``| Directed Acyclic Graph |
| Non-blocking | ``No`` | Yes | Yes |
| Implementation | Easy | ``Difficult`` | Easy |
| Dynamic | ``No`` | ``No`` | Yes |
| Ready to Use | Yes | ``Need PYTHONPATH`` | Yes |
| Subprocesses Handling | ``No`` | Launches & waits | Launches & waits |
| Flow Control | All | `if`, `while` | `if`, `while`, `match` |
| Termination | ``Hard exit`` | ExitCode | ExitCode |
| Data Passing | Direct passing | Context | Link & Context |
| Output Recording | Limited support | Out & validates | Out |
| Port Exposing | Limited support | Manual & automatic | Manual |
Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.



## Installation

```console
pip install aiida-workgraph
pip install aiida-workgraph[widget]
```

To install the latest version from source, first clone the repository and then install using `pip`:
Expand Down Expand Up @@ -67,16 +46,15 @@ Visit the [Workgraph Collections repository](https://github.com/superstar54/work
Suppose we want to calculate ```(x + y) * z ``` in two steps. First, add `x` and `y`, then multiply the result with `z`.

```python
from aiida.engine import calcfunction
from aiida_workgraph import WorkGraph
from aiida_workgraph import WorkGraph, task

# define add calcfunction
@calcfunction
# define add task
@task.calcfunction
def add(x, y):
return x + y

# define multiply calcfunction
@calcfunction
# define multiply task
@task.calcfunction
def multiply(x, y):
return x*y

Expand Down
2 changes: 1 addition & 1 deletion aiida_workgraph/web/backend/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_executor_source(tdata: Any) -> Tuple[bool, Optional[str]]:
source_code = "".join(source_lines)
return source_code
except (TypeError, OSError):
source_code = tdata["executor"].get("function_source_code", "")
source_code = tdata["executor"].get("source_code", "")
return source_code
else:
return str(executor)
Expand Down
Binary file modified docs/source/_static/images/first-workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 30179fc

Please # to comment.