I would like to set trigger rules on specific tasks.
For instance, if i have the following dependencies in my dag:
task_init >> task_1 >> task_2
How can i do it?
You don't need trigger rules for what you're describing:
task_init >> [task_1, task_2]
By default, tasks in Airflow run if the previous task completed successfully. So in this code, task_init
starts, and tasks task_1
and task_2
only start after task_init
completed successfully. A list ( []
) can be used to group tasks together and dependencies can be set between a single task and a list of tasks.
You can also view this in the Airflow Graph View:
Read more about task dependencies here:
task_init >> task_1 >> task_2
task_init >> task_2
This will resolve the problem. More information can be found here https://stackoverflow.com/a/66866925
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.