bluek1te opened a new issue, #27582:
URL: https://github.com/apache/airflow/issues/27582

   ### Apache Airflow version
   
   2.4.2
   
   ### What happened
   
   New DAG with CronTriggerTimetable will sometimes miss the first run of the 
job. If I edit the schedule after the miss, it will usually recover and start 
scheduling on time. This doesn't seem to happen 100% of the time.
   
   ### What you think should happen instead
   
   DAG implementing CronTriggerTimetable with a start_date occurring before the 
current time, with catchup disabled should run at the next time occurrence 
specified by the cron parameter.
   
   
![image](https://user-images.githubusercontent.com/36559283/200938123-0a1d1c20-2899-4908-93d6-a155f2bdc34d.png)
   
   As you can see here, the "next-run" field says that it is scheduled for 
2022-11-09, 20:50:00, and then transforms to the next day without executing a 
run.
   
   
![image](https://user-images.githubusercontent.com/36559283/200938988-3a5e6a3b-6211-43d4-acfd-056ac8b4825f.png)
   
   
   ### How to reproduce
   
   DAG Code Used:
   
   ```from airflow import DAG
   from airflow.operators.bash import BashOperator
   from datetime import datetime, timedelta
   from airflow.timetables.trigger import CronTriggerTimetable
   
   with DAG(
       'cron-trigger-reproduce-bug',
       description='cron-trigger-reproduce-bug',
       start_date=datetime(2022, 1, 1),
       catchup=False,
       schedule=CronTriggerTimetable('50 14 * * *', timezone='America/Chicago'),
       tags=['demo']
   ) as echo:
       slack_hello = BashOperator(
           task_id="echo",
           bash_command="echo Hello World!"
       )
   ```
   
   I add the DAG, let Airflow pick it up, enable it in the web UI, and observe 
that the first run is missed.
   If I modify the cron time again (for a later time), the DAG will recover.
   
   ### Operating System
   
   Official Apache airflow 2.4.2 docker Image (alpine?)
   
   ### Versions of Apache Airflow Providers
   
   Not relevant, example code doesn't use any providers.
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   Running Airflow in on prem k8s with 2 worker instances.
   
   ### Anything else
   
   I am willing to try to write up a PR for this with some mentoring/pointers 
on where to look, thanks!
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to