I am working on scheduling a airflow job. However to verify if I have scheduled the correct job I need to see when it will run in the future.
Airflow has following command which gives me the next run. however, that's not sufficient for some use cases. for example, I have scheduled a job run every other Friday. How do I verify that.
airflow next_execution <dag_id>
Is there a way, I can get all the future dates when this dag will run. or atleast couple of ?
While most processes use croniter, if you have access to your installation it's always best to get the information from the "source" via existing interfaces:
from airflow import models
from datetime import datetime, timedelta
dag_bag = models.DagBag()
dag_id = "dag_name"
dag = dag_bag.get_dag(dag_id)
now = datetime.now()
until = now + timedelta(days=21)
runs = dag.get_run_dates(start_date=now, end_date=until)
print(runs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With