Created
October 3, 2023 17:50
-
-
Save Arqentum/9eda7373ecc05e482da8dff35d469feb to your computer and use it in GitHub Desktop.
#Airflow task branching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| month_mid = DummyOperator(task_id='month_mid') | |
| month_end = DummyOperator(task_id='month_end') | |
| def choose_branch(execution_date, **_): | |
| if execution_date.day == 15: | |
| return month_mid.task_id | |
| else: | |
| return month_end.task_id | |
| branching_step = BranchPythonOperator( | |
| task_id='branching_step', | |
| python_callable=choose_branch | |
| ) | |
| wait_for_ingest >> branching_step >> month_mid >> day_tasks >> final_step | |
| wait_for_ingest >> branching_step >> month_end >> month_tasks >> final_step |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment