【问题标题】:Execution of next task in case of failure- airflow在失败的情况下执行下一个任务 - 气流
【发布时间】:2022-01-14 12:00:19
【问题描述】:

1.4 与作曲家 2.0。

我有一个运行多个任务的 DAG,我遇到的问题是,当一个任务失败时,它无论如何都会运行下一个。

根据气流文档,这不应该是这种情况,而是在任务失败后终止 DAG 的执行。 任务是相互依赖的,所以如果一个失败,下一个将失败。 我希望万一任务失败,DAG的执行将被终止。

default_args = {
    'owner': owner,
    'start_date': datetime.datetime(2021, 12, 28 ,15 ,0 ,0 ), #2021-08-08 10:00:00 UTC-0
    'email': email,
    'email_on_failure': True,
    'retries': 0,  # Retry once before failing the task.
    #'on_failure_callback': incident_pg, #ejecuta funcion en caso de que la tarea falle 
}
with DAG(dag_id=inst_dag_id,
                default_args = default_args,
                catchup = True,  
                max_active_runs = 5,
                #schedule_interval = None) as dag: #ejecucion manual
                schedule_interval = "0 15 * * *" ) as dag:

【问题讨论】:

    标签: airflow google-cloud-composer


    【解决方案1】:

    看起来问题出在任务定义上。在您的问题中包含任务代码会更加透明。根据您的问题,没有定义'trigger_rule'参数,并且从apache-airflow对BaseOperator的定义来看,trigger_rule默认为all_success,这意味着所有上游任务都必须在下游之前成功任务可以执行。

    检查您是否将任务delete_bq_table 的触发规则设置为all_done,如果有,请将其删除或更改为all_success

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-27
      • 2023-03-30
      • 2021-10-18
      • 2017-08-24
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多