Trigger Dag Run
A task that starts a run of another Dag, in place of a task class.
Pass one to DagDef.task and the Java runtime runs it as Airflow's TriggerDagRunOperator does, so the Dag needs no Python worker for it:
dag.task("trigger_downstream",
new TriggerDagRun("downstream_etl")
.config("wait_for_completion", true)
.config("conf", Map.of("rows", 2)));Content copied to clipboard
In an annotated Dag, an @Airflow.Task method returns one instead; the method runs when the Dag is built, not when the task runs.
The task runs no Java code and takes no arguments. It pushes the triggered run's ID, and the link the "Triggered DAG" extra link reads. It renders no templates, so a value such as "{{ ds }}" reaches the new run unchanged. Like a Java task, it runs on the Dag's queue unless the task sets its own.
Parameters
dag Id
trigger_dag_id: the Dag to trigger.
Throws
if dagId is empty.