Reputation: 91
I followed the docs and created slack function:
It does work and I get notifications in channel, but get the name of the task and link to log are to another task, and not to the one that gets failed.
It gets the context of the upstream failed task, but not the failed task itself:
I tried with different operators and hooks, but get the same result. If anyone could help, I would really appreciate it. Thank you!
Upvotes: 0
Views: 323
Reputation: 5110
The goal of the on_failure_callback
argument on the Dag level, is running this callback once when the DagRun fails, so we provide the context of the DagRun
which is identical between the task instances, for that we don't care which task instance context we provide (I think we provide the context of the last defined task in the dag regardless its state).
If you want to run the callback on each failed ti, you can remove the on_failure_callback
argument from the dag and add it to the default args: default_args=dict(on_failure_callback=task_fail_slack_alert)
.
Upvotes: 1