Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the usage of DummyOperator in Airflow?

Tags:

airflow

I 'm new to Airflow and I know DummyOperator just does nothing. So what is the scenario for DummyOperator? When would you typically use it?

like image 822
DennisLi Avatar asked Oct 21 '25 12:10

DennisLi


1 Answers

A common use is to create simplified workflows. Consider an example.

task_1 >> task_3
task_2 >> task_3
task_1 >> task_4
task_2 >> task_4

Technically you want task_3 and task_4 to be executed only after both task_1 and task_2 are completed. But when you look at the graph, it is not super intuitive.

Solution? You can improve the readability (not code readability instead you can understand the graphs and thereby workflow.) by adding a task_dummy after task_1 and task_2 and run task_3 and task_4 after task_dummy. So when a new user takes a look at graphs, he will immediately understand the workflow. The modified workflow will be as follows.

task_1 >> task_dummy << task_2
task_dummy >> task_3
task_dummy >> task_4
like image 128
nightgaunt Avatar answered Oct 25 '25 01:10

nightgaunt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!