如何正确处理Apache Airflow中的夏时制? [英] How to properly handle Daylight Savings Time in Apache Airflow?

查看:101
本文介绍了如何正确处理Apache Airflow中的夏时制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在气流中,所有东西都应该是UTC(不受DST的影响)。

In airflow, everything is supposed to be UTC (which is not affected by DST).

但是,我们有工作流根据时区来传递信息。

However, we have workflows that deliver things based on time zones that are affected by DST.

一个示例方案:


  • 我们已安排工作东部时间的开始日期为8:00 AM,计划时间间隔为24小时。

  • 东部时间的每天上午8点,调度程序会发现距上次运行已经24小时了,

  • DST发生了,我们损失了一个小时。

  • 今天东部时间8点,调度员发现只有23个小时了,因为在机器上的时间是UTC,直到东部标准时间9AM才开始运行,这是一个延迟交货

  • We have a job scheduled with a start date at 8:00 AM Eastern and a schedule interval of 24 hours.
  • Everyday at 8 AM Eastern the scheduler sees that it has been 24 hours since the last run, and runs the job.
  • DST Happens and we lose an hour.
  • Today at 8 AM Eastern the scheduler sees that it has only been 23 hours because the time on the machine is UTC, and doesn't run the job until 9AM Eastern, which is a late delivery

有办法吗?安排dags,以便它们在时间更改后在正确的时间运行?

Is there a way to schedule dags so they run at the correct time after a time change?

推荐答案

此问题是在1.8版本的气流时被问到的.x。

This question was asked when airflow was on version 1.8.x.

此功能自ai以来已内置rflow 1.10。

This functionality is built-in now, as of airflow 1.10.

https:// airflow。 apache.org/timezone.html

airflow.cfg 中设置时区,并且dst应该是处理正确。

Set the timezone in airflow.cfg and dst should be handled correctly.

这篇关于如何正确处理Apache Airflow中的夏时制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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