ashb opened a new issue, #28405:
URL: https://github.com/apache/airflow/issues/28405
In response to someone asking this on the mailing list I proposed
this API:
https://lists.apache.org/thread.html/rcd7fbd99408f5cdc1cc09e8a1619b629743da158ecf4c9d0eeb411f1%40%3Cdev.airflow.apache.org%3E
```python
from airflow.providers.slack.notifiers import send_slack_message
task = MyOperator(
task_id = "something",
on_failure_callback= send_slack_message(
slack_conn_id='slack-default', # Default, not actually required
here, for example only
channels=['#data-ops'],
mentions=['@ash'],
),
)
```
Names can be changed/discussed, this is just a rough idea.
Using this approach means that a) We don't need to add a whole bunch of
new config, and b) it can be easily extended/created by providers
without needing changes to core -- after all the feature to run code
after failure/success already exists, we just want to "package up" the
common task of sending a slack message.
I think for consistency of interface too we should deprecate the
email_on_failure task attribute too in favour of a similar function.
And finally, perhaps `on_*_callback` gets extended to allow a list of
functions instead of just one.
_Originally posted by @ashb in
https://github.com/apache/airflow/issues/12611#issuecomment-849625657_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]