Execution Control
These fields decide when a run's steps start, how many run at once, and how long a step or the whole run may take before it is stopped.
| Control | Field | Default |
|---|---|---|
| Wait before the first step | delay_sec | 0 |
| Steps running at once | max_active_steps | Unlimited |
| Time for one step | step timeout_sec | None |
| Time for the whole run | DAG timeout_sec | None |
| Time for steps to stop cleanly | max_clean_up_time_sec | 5 |
| Signal a stopping step receives | signal_on_stop | The signal that stopped the run |
working_dir: .
timeout_sec: 3600 # the whole run
max_active_steps: 2
max_clean_up_time_sec: 60
steps:
- id: health_check
run: curl -fsS https://example.com/health
timeout_sec: 20 # this step only
- id: export_orders
run: ./export.sh orders
depends: health_check
- id: export_users
run: ./export.sh users
depends: health_check
- id: export_events
run: ./export.sh events
depends: health_checkhealth_check fails if it takes longer than 20 seconds. Once it succeeds, the three exports become ready together, and two run while the third waits for a free slot. After an hour, whatever still runs is stopped and the run ends failed.
Maximum Active Steps
max_active_steps caps how many steps of one run execute at once. Steps that are ready wait for a free slot. Zero or a negative value means unlimited; use -1 to override a positive value inherited from the base configuration.
It does not limit the items of a parallel or foreach step: set max_concurrent on that step. To limit runs rather than steps, use a queue.
Timeout Control
Step Timeout
A step timeout_sec stops that step when it runs too long. The step ends failed with exit code 124, and its retry_policy does not run it again. Its dependents end aborted unless continue_on lets them run.
A step stops at its own timeout_sec or at the run's deadline, whichever comes first: a step timeout longer than the DAG timeout does not extend the run. 0 or no value means no step timeout. Set one for every step with defaults.timeout_sec.
Use step timeouts on network calls and third-party CLIs, so a hung call fails fast while other steps proceed.
Run Timeout
The DAG timeout_sec limits the whole run. When it expires, running steps are stopped and end aborted, steps not yet started do not run, and the run ends failed. The run's handler_on.failure and handler_on.exit still run, each within its own timeout_sec.
Cleanup Timeout
When a run is stopped, by its timeout, dagu stop, or the Web UI, each running step receives its signal_on_stop, or else the signal that stopped the run. max_clean_up_time_sec is how long the steps get to exit before they are killed.
working_dir: .
max_clean_up_time_sec: 120
handler_on:
exit:
run: ./release-lock.sh
timeout_sec: 60
steps:
- id: rebuild
run: ./rebuild-index.sh
signal_on_stop: SIGINTmax_clean_up_time_sec does not limit lifecycle handlers; give each handler its own timeout_sec. A deadline or cancellation from the caller, such as a parent run, still applies to handlers.
Initial Delay
delay_sec waits that many seconds before the first step starts, for example to stagger runs that start at the same minute.
working_dir: .
delay_sec: 60
steps:
- id: report
run: ./report.shRelated Controls
| To | Use | See |
|---|---|---|
| Run steps in order or in parallel | depends | Control Flow |
| Run a child DAG per item | parallel with dag.run | Control Flow |
| Limit concurrent runs of a DAG | queue | Queues |
| Retry a failed step with backoff | retry_policy | Durable Execution |
| Repeat a step with backoff | repeat_policy | Control Flow |
| Cap CPU and memory of a run | resources | DAG Run Resource Limits |

