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

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.9.0
   
   ### What happened?
   
   When use the TimeSensor and set target_time in timezone, i expect it will 
stop after five minutes in current timezone, but it can't stop.
   
   instance: timedatectl set Asia/Taipei
   airflow.cfg: default_timezone set Asia/Taipei
   
   ### What you think should happen instead?
   
   Probably timezone.make_naive(timezone.utcnow(), self.dag.timezone).time() > 
self.target_time is not working
   
   ### How to reproduce
   
   from airflow.decorators import dag
   from airflow.sensors.time_sensor import TimeSensor
   from airflow.timetables.trigger import CronTriggerTimetable
   import datetime, pendulum, textwrap
   
   
   @dag(
       dag_id="test_timesensor",
       schedule=CronTriggerTimetable("0 0 * * *", timezone="Asia/Taipei"),
       start_date=pendulum.datetime(2024, 1, 1),
       default_args={
           "owner": "test",
           "retries": 3,
           "retry_delay": datetime.timedelta(minutes=10),
           "do_xcom_push": False,
       },
       catchup=False
   )
   def generate_dag():
   
       delay_5m = TimeSensor(
           task_id="delay_5m",
           target_time=(pendulum.now("Asia/Taipei") + 
datetime.timedelta(minutes=5)).time(),
           poke_interval=datetime.timedelta(minutes=1),
           timeout=datetime.timedelta(minutes=30),
       )
   
   
   generate_dag()
   
   
   
   ### Operating System
   
   Ubuntu 22.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### 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