Skip to content

Conversation

@ephraimbuddy
Copy link
Contributor

This makes it easy for users to setup notifications for their DAGs using on_*_callbacks It's extensible and we can add it to more providers. Implemented a SlackNotifier in this phase.

In the course of this, I extracted a 'Templater' class from AbstractBaseOperator and have both the Notifier & ABO inherit from it. This is necessary in other to avoid code repetition.

Closes: #28405

@ephraimbuddy ephraimbuddy marked this pull request as draft December 24, 2022 05:24
Copy link
Contributor

@Taragolis Taragolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the idea. Just couple of findings

@ephraimbuddy ephraimbuddy force-pushed the notifier branch 2 times, most recently from db0a827 to ed5d175 Compare December 27, 2022 16:32
@ephraimbuddy ephraimbuddy marked this pull request as ready for review December 27, 2022 19:26
@ephraimbuddy ephraimbuddy marked this pull request as draft December 27, 2022 19:37
@ephraimbuddy
Copy link
Contributor Author

What I'm finding out now is that this solution is not backward-compatible for providers

@Taragolis
Copy link
Contributor

What I'm finding out now is that this solution is not backward-compatible for providers

Maybe we could mark it as Optional feature by raise AirflowOptionalProviderFeatureException if Airflow < 2.6?

@ephraimbuddy
Copy link
Contributor Author

AirflowOptionalProviderFeatureException

Awesome. Didn't know that existed. Thanks

@ephraimbuddy ephraimbuddy force-pushed the notifier branch 2 times, most recently from 013dbb9 to afc3732 Compare December 28, 2022 08:47
@ephraimbuddy ephraimbuddy force-pushed the notifier branch 3 times, most recently from fb2658d to ee928bb Compare December 28, 2022 14:25
@ephraimbuddy ephraimbuddy marked this pull request as ready for review December 28, 2022 15:21
@ephraimbuddy ephraimbuddy added this to the Airflow 2.6.0 milestone Dec 28, 2022
@ephraimbuddy ephraimbuddy added the type:new-feature Changelog: New Features label Dec 28, 2022
@potiuk
Copy link
Member

potiuk commented Dec 29, 2022

Good candidate to be added to #28300 - I will add it there once merged.

@ephraimbuddy
Copy link
Contributor Author

@jedcunningham @uranusjr @dstandish, can you also take a look

Comment on lines 57 to 59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this default value to a module-level constant?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also referencing the main branch is probably a bad idea; we want something more permanent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked to a previous release, how's that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better linking to a commit, but I guess we have enough dev infra around this a tag is immutable-ish enough.

@ephraimbuddy ephraimbuddy force-pushed the notifier branch 3 times, most recently from e5cb596 to 3a0b79b Compare January 3, 2023 11:18
ephraimbuddy and others added 7 commits January 3, 2023 20:46
This makes it easy for users to setup notifications for their DAGs using on_*_callbacks
It's extensible and we can add it to more providers. Implemented a SlackNotifier in this
phase.

In the course of this, I extracted a 'Templater' class from AbstractBaseOperator
and have both the Notifier & ABO inherit from it. This is necessary in other to avoid
code repetition.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@ephraimbuddy ephraimbuddy merged commit a7e1cb2 into apache:main Jan 4, 2023
@ephraimbuddy ephraimbuddy deleted the notifier branch January 4, 2023 20:42
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add docs for this feature @ephraimbuddy ? Currently this feature is a "hidden" one

@potiuk
Copy link
Member

potiuk commented Jan 18, 2023

Should we add docs for this feature @ephraimbuddy ? Currently this feature is a "hidden" one

Agree we should.

@ephraimbuddy
Copy link
Contributor Author

Should we add docs for this feature @ephraimbuddy ? Currently this feature is a "hidden" one

Seeing this now. There's a doc on it: http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow-providers-slack/latest/notifications/slack_notifier_howto_guide.html

@potiuk
Copy link
Member

potiuk commented Jan 18, 2023

Should we add docs for this feature @ephraimbuddy ? Currently this feature is a "hidden" one

Seeing this now. There's a doc on it: http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow-providers-slack/latest/notifications/slack_notifier_howto_guide.html

What I think @kaxil (I for sure) mean is that this adds "base" notifier and "generic" approach that could be extended by anyone. Similarly as other "core extensions" - I think we need some generic description on how one can extend and write their own notifiers (or at the very least information that one CAN actually do it)

Similar docs are here for logging, extra links, logging, secret backends - look here (there are links to generic airlfow how-tos from there) https://airflow.apache.org/docs/apache-airflow-providers/core-extensions/index.html

@ephraimbuddy
Copy link
Contributor Author

Should we add docs for this feature @ephraimbuddy ? Currently this feature is a "hidden" one

Seeing this now. There's a doc on it: http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow-providers-slack/latest/notifications/slack_notifier_howto_guide.html

What I think @kaxil (I for sure) mean is that this adds "base" notifier and "generic" approach that could be extended by anyone. Similarly as other "core extensions" - I think we need some generic description on how one can extend and write their own notifiers (or at the very least information that one CAN actually do it)

Similar docs are here for logging, extra links, logging, secret backends - look here (there are links to generic airlfow how-tos from there) https://airflow.apache.org/docs/apache-airflow-providers/core-extensions/index.html

Fixed: #29191
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers type:new-feature Changelog: New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add general-purpose "notifier" concept to DAGs for easier slack/teams/email notifications

6 participants