This is an automated email from the ASF dual-hosted git repository. dimberman pushed a commit to branch fix-resource-backcompat in repository https://gitbox.apache.org/repos/asf/airflow.git
commit e2fe0b7a7101b24dd3354dc13f5dd1fdac9c0fec Author: zikun <[email protected]> AuthorDate: Sun Jul 19 01:36:28 2020 +0800 TimeSensor should respect the default_timezone config (#9699) (cherry picked from commit b34ba874452809495354f3012e0b1dcbf4209e09) --- UPDATING.md | 7 +++++++ airflow/sensors/time_sensor.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/UPDATING.md b/UPDATING.md index 2057491..faa75fd 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -63,6 +63,13 @@ https://developers.google.com/style/inclusive-documentation --> ## Airflow 1.10.13 +### 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. + ### Removed Kerberos support for HDFS hook The HDFS hook's Kerberos support has been removed due to removed python-krbV dependency from PyPI diff --git a/airflow/sensors/time_sensor.py b/airflow/sensors/time_sensor.py index 0c39235..d26c32d 100644 --- a/airflow/sensors/time_sensor.py +++ b/airflow/sensors/time_sensor.py @@ -37,4 +37,4 @@ class TimeSensor(BaseSensorOperator): 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
