# Ewoks Engines
Ewoks workflows can be executed using several engines, each with its own capabilities:
- [**Dask**](https://www.dask.org/): Distributed and parallel computing framework.
- [**Pypushflow**](https://pypushflow.readthedocs.io/): Scheduler for acyclic and cyclic task graphs.
- [**Orange**](https://orangedatamining.com/): Visual programming and data visualization platform.
## Using a Supported Engine
To run workflows with a specific engine, install the appropriate extra:
```bash
pip install ewoks[dask] # For Dask
pip install ewoks[ppf] # For Pypushflow
pip install ewoks[orange] # For Orange
```
If no engine is installed, Ewoks defaults to a basic sequential engine (`"core"`).
To specify the engine explicitly, use the `--engine` option:
```bash
ewoks execute --test demo --engine dask
```
::::{warning}
**Orange execution is GUI-driven** and cannot be triggered from the CLI.
Running:
```bash
ewoks execute --test demo --engine orange
```
...will open the Orange GUI, where you can edit the workflow.
To execute it:
- Double-click on `task0` in the workflow.
- Use the **Trigger** button in the **Task** widget.
For guidance, see [Orange's getting started docs](https://orangedatamining.com/getting-started/).
::::
## Engine Feature Comparison
Some engines support more advanced features, like loops or GUI interaction:
| engine | Loops | Conditional Links | Parallel execution | Interaction (GUI) | Native support |
|------------|-------------------------------------|-------------------------------------|----------------------------------------|-------------------------------------|-------------------------------------|
| `"core"` | ✗ | ✗ | ✗ | ✗ | ✓ |
| `"dask"` | ✗ | ✗ | ✓ | ✗ | ✓ |
| `"ppf"` | ✓ | ✓ | ✓ | ✗ | ✓ |
| `"orange"` | ✗ | ✗ | ✓ | ✓ | ✗ |
::::{note}
**Native support** means that Ewoks tasks can be executed without modification.
For Orange, you must wrap each Ewoks task in a corresponding Orange widget. See the
[Orange widget tutorial](https://ewoksorange.readthedocs.io/en/stable/tutorials/my_first_widget.html)
in the `ewoksorange` documentation.
::::
## Adding a New Engine to Ewoks
To add a custom engine named `"abc"`
```bash
ewoks execute --test demo --engine abc
```
create a Python package with the appropriate entry point in `pyproject.toml`:
```toml
[project]
name = "ewoksabc"
[project.entry-points."ewoks.engines"]
"abc" = "ewoksabc.engine:AbcWorkflowEngine"
```
Your engine must implement the abstract interface `WorkflowEngine` from `ewokscore`:
```python
from ewokscore.graph import TaskGraph
from ewokscore.engine_interface import WorkflowEngine
class AbcWorkflowEngine(WorkflowEngine):
def execute_graph(self, graph: TaskGraph, ...) -> Optional[dict]:
...
```
### (Optional) Workflow Serialization Support
If your engine also handles workflow (de)serialization (e.g., from `.xyz` files), add another entry point:
```toml
[project.entry-points."ewoks.engines.serialization.representations"]
"xyz" = "ewoksabc.engine:AbcWorkflowEngine"
```
Your engine should implement `WorkflowEngineWithSerialization`:
```python
from ewokscore.engine_interface import WorkflowEngineWithSerialization
class AbcWorkflowEngine(WorkflowEngineWithSerialization):
def execute_graph(self, graph: TaskGraph, ...) -> Optional[dict]:
...
def deserialize_graph(self, graph: Any, ...) -> TaskGraph:
...
def serialize_graph(self, graph: TaskGraph, ...) -> Any:
...
def get_graph_representation(self, graph: Any) -> Optional[str]:
...
```
This allows Ewoks to recognize and delegate serialization/deserialization to your engine.