From e1df9e7803cef06c7b4de1877b387e0ac2afabf7 Mon Sep 17 00:00:00 2001 From: zikun <33176974+zikun@users.noreply.github.com> Date: Tue, 7 Jul 2020 00:16:47 +0800 Subject: [PATCH 1/2] TimeSensor should consider the default_timezone config --- airflow/sensors/time_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/sensors/time_sensor.py b/airflow/sensors/time_sensor.py index 210dc00aad4ca..69feaaefafb2a 100644 --- a/airflow/sensors/time_sensor.py +++ b/airflow/sensors/time_sensor.py @@ -36,4 +36,4 @@ def __init__(self, target_time, *args, **kwargs): def poke(self, context): self.log.info('Checking if the time (%s) has come', self.target_time) - return timezone.utcnow().time() > self.target_time + return timezone.make_naive(timezone.utcnow()).time() > self.target_time From b88cd95556ad0cb5cc270cbc05bf0d276a3758d5 Mon Sep 17 00:00:00 2001 From: zikun <33176974+zikun@users.noreply.github.com> Date: Sat, 18 Jul 2020 11:18:12 +0800 Subject: [PATCH 2/2] Add note in UPDATING.md --- UPDATING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING.md b/UPDATING.md index c5097aeb34521..b58eaf1bb9e70 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -1475,6 +1475,12 @@ arguments, please change `store_serialized_dags` to `read_dags_from_db`. Similarly, if you were using `DagBag().store_serialized_dags` property, change it to `DagBag().read_dags_from_db`. +### TimeSensor will consider default_timezone setting. + +Previously `TimeSensor` always compared the `target_time` with the current time in UTC. + +Now it will compare `target_time` with the current time in the timezone set by `default_timezone` under the `core` section of the config. + ## Airflow 1.10.11