You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amoghrajesh (via GitHub)" <gi...@apache.org> on 2025/09/17 12:07:44 UTC
[PR] Replace send_email from utils in task SDK with its own [airflow]
amoghrajesh opened a new pull request, #55769:
URL: https://github.com/apache/airflow/pull/55769
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
## Why?
Task SDK uses the ability to send emails but it imports it from airflow.utils. As part of client server separation, getting rid of these imports in task sdk. This PR moves the _send_email function from utils to the task runner module to consolidate email-related functionality where it's actually used.
## Changes
* Moved _send_email function from utils to task runner
* Added test to verify email functionality works correctly in the new location -- there was no task test that did this
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3405951183
Thanks for all your comment, let's repurpose the existing SMTP notifier to do the email sending portion for us
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh closed pull request #55769: Replace send_email from utils in task SDK with its own
URL: https://github.com/apache/airflow/pull/55769
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3302820946
I think there is a qausi-dep there already -- SMTP provider was core, and you can define the credentials in an SMTP connection inside Airflow, can't you?
This doesn't need to be a hard (i.e. pyproject-level) dependency
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3302824524
I've thought about it before, and changing `email_on_failure` automatically to an SMTPNotifier seems like the way to go here. And if you set `email_on_failure` and the provider isn't importable, we can raise a nice error message to show up as a dag parse errror
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3323914433
I am really not sure where are we going with the email/smtp integration.
My wish to get rid of it in Airflow 3 and treat it like any other notifier out there was not successful.
I am hoping we can get to a state where all email core related stuff are 100% deprecated and advise users migrate to the SMTP notifier. I don't think we need to continue build things in task sdk for emails.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3495636750
Closing in favour of https://github.com/apache/airflow/pull/57354
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3304761650
fyi: https://github.com/apache/airflow/pull/47146 & https://lists.apache.org/thread/tbnf2rcrowrp3ktltrhrcjvc53k58oxx
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3302772197
@ashb we could, but do we want to create a dependency between task sdk and smtp provider? I did this to avoid that
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Replace send_email from utils in task SDK with its own [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #55769:
URL: https://github.com/apache/airflow/pull/55769#issuecomment-3323961453
Lets not port this over then.
Instead lets "upgrade in place" the use of `email_on_failure` attr etc and automatically convert that to an SmtpNotifier instance. And if the smtp provider isn't installed raise a nice error of "You need to install apache-airflow-providers-smtp to use this feature".
I'll leave @amoghrajesh do decide if this PR gets closed or re-purposed.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org