apache-airflow 1.9默认时区设置为non utc [英] apache-airflow 1.9 default timezone set to non utc

查看:208
本文介绍了apache-airflow 1.9默认时区设置为non utc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将气流版本从airflow 1.8升级到apache-airflow 1.9,升级成功,并且我使用Celery Executor扩展了环境,一切似乎都正常,但是dag和任务的开始日期,执行日期等出现在UTC时区中,而调度的dags则运行在UTC中,而在升级之前,它们曾在本地时区(pdt)中运行。

I had recently upgraded airflow version from airflow 1.8 to apache-airflow 1.9, the upgrade was successful and I have scaled the environment using Celery Executor, everything seemed to be working fine but the dag and tasks start dates, execution dates etc all are appearing in UTC timezone and the scheduled dags are running in UTC, earlier before the upgrade they used to run in Local timezone which is pdt.

关于如何将pdt设置为气流默认时区的任何想法?

Any ideas on how to make pdt as the default timezone in airflow?

我尝试在 airflow.cfg default_timezone >到 default_timezone = pdt ,但即使在重新启动所有服务后,它仍会在UTC中安排dag和任务。

I have tried using default_timezone in the airflow.cfg to default_timezone = pdt but even after restarting all the services it schedules the dags and tasks in UTC. Looking forward to your help on fixing the default timezone to pdt.

推荐答案

在版本1.9.0之前的本地时区中运行的气流,期待您的帮助。是意料之外的,只是使用 datetime.now() datetime.today()代替Airflow代码的副作用 datetime.utcnow()。此问题已在1.9.0中的 AIRFLOW-289 下进行了纠正,从而使时区不受限制(

Airflow running in the local timezone prior to version 1.9.0 was unintended and just a side effect of Airflow code using datetime.now() and datetime.today() instead of datetime.utcnow(). This was rectified in 1.9.0 under AIRFLOW-289, making things timezone independent (always UTC) as you have observed.

对Airflow具有时区感知功能的官方支持已合并到master分支中。此工作已作为 AIRFLOW-288 的一部分完成,并且不是在最新的稳定版本(1.9.0)中可用。您可能会在下一个主要版本中期望它。

Official support for Airflow to be timezone aware is merged into the master branch. This work was completed as part of AIRFLOW-288 and is not available in the latest stable version (1.9.0). You can probably expect it in the next major release.

一旦进行了更改,Matt的答案应该会为您提供所需的内容。

Once you have that change, Matt's answer should get you what you're looking for.

这篇关于apache-airflow 1.9默认时区设置为non utc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆