气流DAG成功回调 [英] Airflow DAG success callback
问题描述
是否有一种优雅的方法来为DAG成功事件定义回调?
我真的不想设置一个任务,它将通过on_sucess_callback置于所有其他任务的上游。
Is there an elegant way to define callback for DAG succeed event? I really don't want to set a task which will be upstream of all other tasks with on_sucess_callback.
谢谢!
推荐答案
因此,如果我理解正确,则DAG的最后一步是在成功的情况下回叫其他系统。因此,我鼓励您完全按照这种方式对DAG进行建模。
So if I understand correctly, the last step of your DAG is, in case of success, to call back to some other system. So I would encourage you to model your DAG exactly that way.
为什么要尝试从DAG逻辑中隐藏该部分?这正是上游/下游建模的目的。为了图形的美观,将DAG逻辑的一部分隐藏起来对我来说似乎是一个不好的权衡。
Why would you try to hide that part from the logic of your DAG? That's exactly what the up/downstream modeling is for. Hiding part of the DAG logic for the sake of the graph's aesthetics sounds like a bad tradeoff to me.
我不建议您将回调任务设置为 all 任务的下游,应该仅将其设置为 final DAG中的任务。
I would discourage you to set the callback task as downstream to all tasks, it should be downstream only to final tasks in the DAG.
这篇关于气流DAG成功回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!