'Run DAG every M minutes for N times exactly

I’m looking for a way to execute my DAG every M minutes for N times, where M, and N are integers I want to control.

Is there an elegant way to handle this in Airflow? Let’s assume that I have the following tasks and dependency.

t1 = BashOperator(
    task_id='t1’,
    bash_command='echo 1',
)

t2 = BashOperator(
    task_id='t2’
    bash_command='echo 1',
)

t3 = BashOperator(
    task_id='t3’
    bash_command='echo 1',
)

t1 >> [t2, t3]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source