如何正常工作气流schedule

编程入门 行业动态 更新时间:2024-10-27 16:39:43
本文介绍了如何正常工作气流schedule_interval的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想尝试使用Airflow代替Cron。 但是schedule_interval不能按我预期的那样工作。

I want to try to use Airflow instead of Cron. But schedule_interval doesn't work as I expected.

我写了如下的python代码。 在我的理解中,Airflow应该在 2016/03/30 8:15:00上运行,但当时不起作用。

I wrote the python code like below. And in my understanding, Airflow should have ran on "2016/03/30 8:15:00" but it didn't work at that time.

我想,如果我将其更改为'schedule_interval':timedelta(minutes = 5),则它可以正常工作。

If I changed it like this "'schedule_interval': timedelta(minutes = 5)", it worked correctly, I think.

notice_slack.sh仅是为了向我的频道调用松弛api。

The "notice_slack.sh" is just to call slack api to my channels.

# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os from airflow.operators import BashOperator from airflow.models import DAG from datetime import datetime, timedelta args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': datetime(2016, 3, 29, 8, 15), } dag = DAG( dag_id='notice_slack', default_args=args, schedule_interval="@daily", dagrun_timeout=timedelta(minutes=1)) # cmd file name CMD = '/tmp/notice_slack.sh' run_this = BashOperator( task_id='run_transport', bash_command=CMD, dag=dag)

<我想在s上运行一些脚本

I want to run some of my scripts at specific time every day like this cron setting.

15 08 * * * bash /tmp/notice_slack.sh

我已阅读文档计划和触发器,我知道它的cron有点不同。 因此,我尝试安排 start_date和 schedule_interval设置。

I have read the document Scheduling & Triggers, and I know it's a little bit different cron. So I attempt to arrange at "start_date" and "schedule_interval" settings.

有人知道我应该怎么做吗?

Does anyone know what should I do ?

气流版本

airflow version

信息-使用执行程序LocalExecutor

INFO - Using executor LocalExecutor

v1.7.0

amazon-linux-ami / 2015.09-release-notes

amazon-linux-ami/2015.09-release-notes

推荐答案

当以下情况时,气流将启动DAG通过了2016/03/30 8:15:00 +计划间隔(每天)。因此,您的DAG将于2016/03/31 8:15:00运行。

Airflow will start your DAG when the 2016/03/30 8:15:00 + schedule interval (daily) is passed. So your DAG will run on 2016/03/31 8:15:00.

您可以检查气流常见问题解答

更多推荐

如何正常工作气流schedule

本文发布于:2023-11-24 01:23:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623468.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:气流   工作   schedule

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!