1

My airflow dag has catchup as false

Now when I am trying to pass execution_date airflow variable to a script then it it passing the date for previous day.

My airflow timezone is set as America/Los_angelos in the airflow.cfg file (PST TIMEZONE)

Also, it is defintely not a timezone issue. I checked the timings in UTC. The PST dag time is on same UTC day

OVERTHETOP
  • 31
  • 2
  • 1
    Check https://stackoverflow.com/a/65196624/14624409 – Elad Kalif Jul 27 '22 at 16:29
  • @EladKalif it is not thaf issue. I have already checked it – OVERTHETOP Jul 27 '22 at 16:42
  • 1
    It sound like it is? execution_date is always 1 interval behind. So if you have daily job it will be 1 day behind. This is exactly what is explained in the answer I liked. If you feel differently please edit your question and clarify. – Elad Kalif Jul 27 '22 at 16:50

1 Answers1

2

If you want to pass the current date (i.e the date the DAG is triggered) you need to pass data_interval_end. This date represents the end of the data interval that the DAG covers and will be the date that the DAG is triggered.

data_interval_end is a property on the dag_run object

The reason why execution_date is one interval behind is explained here: https://airflow.apache.org/docs/apache-airflow/stable/faq.html#faq-what-does-execution-date-mean

The data_interval is only available in Airflow 2.2+. If you are on a lower version, you will have to work it out yourself using the schedule and the execution date.

Daniel T
  • 531
  • 2
  • 5