Skip to main content
100%

DAG dynamically generating tasks

✓ Published0🌍 Public
RRobinL
Last edited Jul 14, 2018
Created on Jul 14, 2018

This example shows an Airflow DAG that dynamically generates a variable number of tasks at runtime, using a `random.choice` call to select between one and six `BashOperator` tasks. The DAG links a starting `print_date_1` task to each generated task, and each generated task to a shared `final` task. The code constructs these dependencies with the `>>` and `<<` operators, while the Airflow `BashOperator` and `DAG` classes manage task execution. The visualisation displays the dynamically created task graph, highlighting how Airflow's scheduler can struggle when task topology changes mid-run.

AI-generated description

Similar vizzes