Airflow 如何添加SLA';在气流中运行的ETL作业?

Airflow 如何添加SLA';在气流中运行的ETL作业?,airflow,airflow-scheduler,service-level-agreement,Airflow,Airflow Scheduler,Service Level Agreement,我是新来的。我有一些DAG已经在气流中运行了。现在,我想在其中添加SLA,以便跟踪和监视任务,并在出现故障时发出警报 我知道如何使用timedelta()将SLA添加到DAGs默认参数,如下所示 default_args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': datetime(2015, 6, 1), 'email': ['airflow@example.com'],

我是新来的。我有一些DAG已经在气流中运行了。现在,我想在其中添加SLA,以便跟踪和监视任务,并在出现故障时发出警报

我知道如何使用timedelta()将SLA添加到DAGs默认参数,如下所示

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2015, 6, 1),
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    'sla': timedelta(minutes=30)
}
但我有以下问题:

  • 我们可以为整个DAG指定SLA,还是仅为单个任务指定SLA

  • 对于运行30分钟的DAG,什么是合适的SLA时间

  • 对于运行5分钟的任务,什么是合适的SLA时间

  • 在指定SLA?

    时,我们还需要考虑RejyLyTelp吗? 我们可以为整个DAG指定SLA,还是仅为单个任务指定SLA

    我认为SLA仅作为一个整体提供。但我认为,通过在最后创建一个依赖于DAG的所有其他任务的任务(
    DummyOperator
    ),并在该结束任务上设置SLA,整个DAG也可以达到同样的效果(但不能肯定)


    对于运行30天的DAG,什么是合适的SLA时间 分钟

    这完全取决于任务的关键性、失败率等因素。但我建议您从“足够严格”的时间增量(如5分钟)开始,然后调整它(增加或减少)


    对于正在运行5天的任务,什么是合适的SLA时间 分钟

    和上面一样,从1分钟开始,从那里开始调音


    我们在指定SLA?

    时还需要考虑RejyLyTelp吗? 如果是的话,我会说是的

    :param sla: time by which the job is expected to succeed. Note that
            this represents the ``timedelta`` after the period is closed. For
            example if you set an SLA of 1 hour, the scheduler would send an email
            soon after 1:00AM on the ``2016-01-02`` if the ``2016-01-01`` instance
            has not succeeded yet.
    
    我们可以为整个DAG指定SLA,还是仅为单个任务指定SLA

    我认为SLA仅作为一个整体提供。但我认为,通过在最后创建一个依赖于DAG的所有其他任务的任务(
    DummyOperator
    ),并在该结束任务上设置SLA,整个DAG也可以达到同样的效果(但不能肯定)


    对于运行30天的DAG,什么是合适的SLA时间 分钟

    这完全取决于任务的关键性、失败率等因素。但我建议您从“足够严格”的时间增量(如5分钟)开始,然后调整它(增加或减少)


    对于正在运行5天的任务,什么是合适的SLA时间 分钟

    和上面一样,从1分钟开始,从那里开始调音


    我们在指定SLA?

    时还需要考虑RejyLyTelp吗? 如果是的话,我会说是的

    :param sla: time by which the job is expected to succeed. Note that
            this represents the ``timedelta`` after the period is closed. For
            example if you set an SLA of 1 hour, the scheduler would send an email
            soon after 1:00AM on the ``2016-01-02`` if the ``2016-01-01`` instance
            has not succeeded yet.