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.
Thanks!
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.
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.
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.
Don't know how much it helps you now, but the functionality you are looking for exists in Airflow 1.10... a DAG has an on_success_callback
https://airflow.apache.org/code.html#airflow.models.DAG
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With