I have a cronjob that runs with the cron schedule interval 05 */1 * * 1-5
. Or as Crontab Guru says, “At minute 5 past every hour on every day-of-week from Monday through Friday.” (in EST instead of UTC)?
How can I convert this into a 'America/New_York' timezone aware Airflow DAG that will run the same exact way?
I asked a previous question on timezone aware DAGs in Airflow but it is not apparent to me in the answer or in the Airflow documentation how to make the jump from a DAG that has a start_date
with tzinfo
and a schedule_interval
that mimics a cronjob.
I am currently trying to use a DAG with the my_dag.py
file as follows:
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
import pendulum
local_tz = pendulum.timezone("America/New_York")
default_args=dict(
owner = 'airflow',
start_date=datetime(2018, 11, 7, 13, 5, tzinfo=local_tz), # 1:05 PM on Nov 7
schedule_interval=timedelta(hours=1),
)
dag = DAG('my_test_dag', catchup=False, default_args=default_args)
op = BashOperator(
task_id='my_test_dag',
bash_command="bash -i /home/user/shell_script.sh",
dag=dag
)
However, the DAG never gets scheduled. What am I doing wrong here?