Tuesday, July 26, 2022

[SOLVED] How to instruct cron to execute a job in airflow Run every 3rd Jan, 3rd April, 3rd July, 3rd Oct at 11:00 AM UTC Time Zone

Issue

How to instruct cron to execute a job in airflow Run every 22nd Jan, 22nd April, 22nd July, 22nd Oct at 11:00 AM UTC Time Zone.

I have written below cron command to execute in airflow but it is not running at per scheudled

schedule_interval="0 11 22 1/3 *"


Solution

A cron-to-human-translator such as crontab.guru is a convenient tool for writing cron expressions:

0 11 22 1,4,7,10 *
  • 0 = Minute 0
  • 11 = Hour 11
  • 22 = Day 22
  • 1,4,7,10 = Months January, April, July, and October
  • * = Any day of the week

By default, UTC is applied in Airflow, but you can configure this globally (AIRFLOW__CORE__DEFAULT_TIMEZONE), or per DAG. See documentation: https://airflow.apache.org/docs/apache-airflow/stable/timezone.html#default-time-zone.



Answered By - Bas Harenslak
Answer Checked By - Willingham (WPSolving Volunteer)