Skip to content

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.

ControlFieldDefault
Wait before the first stepdelay_sec0
Steps running at oncemax_active_stepsUnlimited
Time for one stepstep timeout_secNone
Time for the whole runDAG timeout_secNone
Time for steps to stop cleanlymax_clean_up_time_sec5
Signal a stopping step receivessignal_on_stopThe signal that stopped the run
yaml
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_check

health_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.

yaml
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: SIGINT

max_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.

yaml
working_dir: .
delay_sec: 60

steps:
  - id: report
    run: ./report.sh

Related Controls ​

ToUseSee
Run steps in order or in paralleldependsControl Flow
Run a child DAG per itemparallel with dag.runControl Flow
Limit concurrent runs of a DAGqueueQueues
Retry a failed step with backoffretry_policyDurable Execution
Repeat a step with backoffrepeat_policyControl Flow
Cap CPU and memory of a runresourcesDAG Run Resource Limits

Dagu is open source under the GNU General Public License v3.0.