场合: 我们有一个DAG(每日ETL过程),有20个任务。有些任务是独立的,大多数都有依赖结构。
问题: 当独立任务失败时,Airflow会停止整个DAG执行并将其标记为失败。
问题: 只要满足所有依赖关系,是否可以强制Airflow继续执行DAG?这样一个失败的独立任务就不会阻止所有其他流的整个执行。
这似乎是一个微不足道的基本问题,我真的很惊讶没有其他人对这种行为有任何疑问。 (也许我只是遗漏了一些东西)
答案 0 :(得分:1)
您可以为每个单独的歌剧设置触发规则。
所有运算符都有一个trigger_rule参数,该参数定义生成的任务被触发的规则。 trigger_rule的默认值是all_success,可以定义为“当所有直接上游任务都成功时触发此任务”。此处描述的所有其他规则都基于直接父任务,并且是在创建任务时可以传递给任何操作员的值:
all_success: (default) all parents have succeeded
all_failed: all parents are in a failed or upstream_failed state
all_done: all parents are done with their execution
one_failed: fires as soon as at least one parent has failed, it does not wait for all parents to be done
one_success: fires as soon as at least one parent succeeds, it does not wait for all parents to be done