Trigger a DAG Run and Wait for Completion
A 5-step recipe with Apache Airflow. We can help you get access.
Recipe · 5 steps
Trigger a DAG Run and Wait for Completion
with Apache Airflow
Trigger an Airflow DAG run and block until it succeeds or fails.
- Read the DAG to confirm it exists and to learn whether it is currently paused before attempting to trigger it.
- Unpause the DAG so the scheduler will actually run the tasks. The update_mask limits the patch to the is_paused field, leaving every other DAG attribute untouched.
- Create the DAG run with the caller supplied run id, logical date, and conf payload. Airflow returns the run immediately in the queued state.
- Poll the DAG run until Airflow stamps an end_date, which it does only when the run reaches a terminal state (success or failed). Retries every 15 seconds for up to 80 attempts (~20 minutes).
- List the task instances for the finished run so the caller can report which tasks ran, how long they took, and where any failure landed.
What you'll need to have ready
- dagId: The DAG identifier to trigger (e.g. "example_bash_operator").
- dagRunId: The run identifier to assign. Supplying this makes the trigger idempotent from the caller's side: re-posting the same run id returns a 409 rather than starting
- logicalDate: The logical (execution) date for the run in ISO 8601 form, e.g. "2026-07-17T00:00:00+00:00". When omitted Airflow uses the current time.
- conf: The JSON configuration passed to the DAG run and read by tasks via dag_run.conf. Defaults to an empty object.
- note: A free-text note recorded against the DAG run for auditability.
For your developer
Arazzo workflow apache-airflow:trigger-dag-run, 5 operations: getApiV2DagsByDagId → patchApiV2DagsByDagId → post_dag_run → getApiV2DagsByDagIdDagRunsByDagRunId → get_task_instances. Specs on APIs.io.