Distributed Execution
Distributed execution runs DAGs on worker processes on other machines. The server keeps every run's state, while workers connect out to its coordinator and keep only the files of the runs they execute.
Architecture
- The server is the Web UI, API, scheduler, and coordinator.
dagu start-allruns all four;dagu coordinatorruns the coordinator alone. - The coordinator is a gRPC service on port
50055. The scheduler and API hand it runs, and it hands them to workers. - Workers dial the coordinator. They need no inbound port, and they do not mount the server's data or DAG directory.
- The task carries the DAG definition. Scripts and other files beside the DAG travel as file dependencies.
- Workers send back status, logs, artifacts, and DAG state over the same connection. Logs stream while the run is active, so the Web UI shows them live.
Set Up
Let workers reach the coordinator. It listens on
127.0.0.1by default:bashdagu start-all \ --coordinator.host=0.0.0.0 \ --coordinator.advertise=<server-address>--coordinator.advertiseis the address workers use. It defaults to the host name. See Distributed Networking for Docker, Kubernetes, and private networks.Add a worker. In the Web UI, open System Status, click Add worker in the Workers section, and enter the address workers use to reach the coordinator. On the server host, this does the same:
bashdagu worker invite --address <server-address>:50055Run the printed command on the worker host. Add labels that describe the machine:
bashdagu worker \ --worker.coordinators=<server-address>:50055 \ --worker.invite=<invite> \ --worker.labels=gpu=true,region=euThe worker enrolls, receives its own certificate, and connects over TLS. A restart reuses the certificate while the worker keeps its data directory, so the invite is needed once.
Route a DAG to it with
worker_selector:yamlworker_selector: gpu: "true" steps: - run: nvidia-smi
The worker appears in the Workers section of System Status with its labels and connection. See Workers for health and settings, and Add Workers With Invites for reusable invites and certificate renewal.
How a Run Reaches a Worker
- A worker keeps polling and sends a heartbeat every second. The coordinator gives a task only to a healthy worker whose labels match the DAG's
worker_selector. - When no healthy worker matches, the coordinator holds the run as Queued for up to
coordinator.worker_wait_timeout,2mby default. The first matching worker that registers in time takes it; after that, the run fails with an error that names the selector.0refuses the dispatch at once. - When a worker stops responding, its runs are marked failed. See Worker Health.
Local or Distributed
Each run goes through these rules in order, and the first match decides:
| Order | Condition | Runs |
|---|---|---|
| 1 | worker_selector: local | Locally, on the server |
| 2 | No coordinator is enabled | Locally |
| 3 | worker_selector has labels | On a matching worker |
| 4 | default_execution_mode: distributed | On any worker |
| 5 | Otherwise | Locally |
A run bound to a worker node goes to that worker by its ID, whatever these rules say. With coordinator.enabled: false, such a run fails before it starts. See Node Targeting.
The same rules apply to every way a run starts: the Web UI and API, retries, dagu enqueue, schedules, queues, and sub-DAG steps.
Queued Runs
An enqueued run enters the server's queue first. The queue applies max_concurrency, and the rules above decide only when the run leaves the queue. Distributed runs therefore count against queue limits too.
Sub-DAG Dispatch
Each sub-DAG decides for itself. A local parent can send a child to a worker, and a parent on a worker can run a child locally with worker_selector: local. This holds for action: dag.run and action: dag.enqueue, except that a parent on a worker cannot use dag.enqueue: a worker has no queue to put the child in.
A step can set the child's selector:
steps:
- action: dag.run
with:
dag: train-model
worker_selector:
gpu: "true"Default Execution Mode
To send every DAG to workers, including those without a worker_selector:
# config.yaml
default_execution_mode: distributedDAGU_DEFAULT_EXECUTION_MODE=distributed does the same.
Build workflows run locally
type: build needs local file fencing and is rejected on workers. With a distributed default, set worker_selector: local on each build workflow. See Build Workflows.
Force Local Execution
worker_selector: local keeps a DAG on the server, whatever the default and any labels:
worker_selector: local
steps:
- run: curl -fsS http://localhost:8080/api/v1/healthHuman Tasks
A root DAG with action: human.task follows the same rules. When a worker reaches the task, it saves the waiting state and releases the run. Once the form is completed, the scheduler queues the same run again, so the scheduler must keep running. Sub-DAGs cannot contain human tasks.
Security
Processes that share the coordinator's data directory, such as dagu start-all, connect over TLS with no setting. Workers that join with an invite connect over mutual TLS with their own certificates. A worker that joins without one uses plaintext gRPC, and System Status flags it with the change that moves it to TLS.
The worker connection controls what runs where, so protect it like the server itself. See Transport Security.

