本文介绍了气流cron表达式未正确调度dag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索将Airflow用作cron,以便在设置cron时可以使用其其他功能。

I am exploring Airflow to be used as a cron so that I could use its other features while setting up the cron.

我正在通过设置cron来测试其功能。例如
2,3,5,8,* * * * 。我期望特定的dag计划在每小时的第2、3、5和8分钟进行。但是实际上,第2分钟的dag是在3日执行的,在5日是3日,在8日是5日。而且它根本不执行第八次。我猜想它将在下一个小时的第二分钟的第8分钟执行。

I was testing its functionality by setting cron like"2,3,5,8, * * * *". I was expecting particular dag to be scheduled on minute 2,3,5 and 8 of every hour. However in reality the dag for 2nd minute is executed on 3rd, for 3rd on 5th and for 5th on 8th. And it is not executed for 8th at all. I guess it would be executed for 8th on 2nd minute of the next hour.

看起来像某种错误或气流中cron表达的情况未处理。

Looks like some kind of a bug or not handled case for cron expression in airflow.

推荐答案

是的,这是因为气流不是在间隔上执行,而是在间隔完成后执行。由于您指定了2、3、5、8分钟,因此它将在这些时间间隔的3、5、8和2结束时运行。这在文档

Yeah, that's because airflow doesn't execute on the interval, but rather after that interval has finished. Since you specify minutes 2, 3, 5, 8 then it will run at the end of those intervals, on 3, 5, 8, and 2. That's explained in the docs here

这篇关于气流cron表达式未正确调度dag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:26