首页 > 解决方案 > 气流任务调度器

问题描述

我的要求是从每周日晚上 9 点到周五晚上 9 点每 5 分钟安排一次 dag 任务。谁能帮我实现这一点。

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2019,4,13,21,0),
    'email': [],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    # 'retry_delay': timedelta(minutes=5),
    # 'queue': 'bash_queue',
    # 'pool': 'backfill',
    # 'priority_weight': 10,
    # 'end_date': datetime(2016, 1, 1),
}


dag = DAG(
    'EUR_USD', catchup=False, default_args=default_args )

    # Define the task that prints hello with the bash operator.
    t1 = BashOperator(
    task_id='FxScheduler',
    schedule_interval="*/5 * * * 1-5",
    bash_command='sh Hello.sh ',
    dag=dag
)

我已经使用了上面的代码,我怎么能提到这个任务必须在周五晚上 9 点停止,而它又必须在周日晚上 9 点开始?

标签: airflow

解决方案


我认为您可以参考此wiki 页面

时间表应为“*/5 * * * 0-5”。


推荐阅读