-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-1723] make sendgrid a plugin #2727
Conversation
@msumit @criccomini PTAL. Re: sendgrid config, I am neutral to environment var or a new sendgrid connection type, kindly let me know which one would be preferred. |
Codecov Report
@@ Coverage Diff @@
## master #2727 +/- ##
==========================================
+ Coverage 72.46% 72.65% +0.19%
==========================================
Files 154 154
Lines 11836 11824 -12
==========================================
+ Hits 8577 8591 +14
+ Misses 3259 3233 -26
Continue to review full report at Codecov.
|
can you add some documentation on how to use it? |
airflow/contrib/utils/sendgrid.py
Outdated
response = sg.client.mail.send.post(request_body=mail_data) | ||
# 2xx status code. | ||
if response.status_code >= 200 and response.status_code < 300: | ||
log.info('The following email with subject %s is successfully sent to sendgrid.' % subject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it makes sense, but instead of saying that successfully sent to sendgrid
can we say successfully sent to following recipients <recipients>
?
@fenglu-g I am fine with the current env variable way. Also, +1 to Bolke's suggestion to provide example/documentation on how to use this backend. |
@msumit revised log message with detailed recipient information, PTAL. Here's how a local integration test look like
Starting attempt 1 of 2 [2017-10-27 06:12:03,847] {models.py:1358} INFO - Executing <Task(EmailOperator): email> on 2017-10-25 00:00:00 |
email_backend = airflow.contrib.utils.sendgrid.send_email | ||
2. configure Sendgrid specific environment variables at all Airflow instances: | ||
SENDGRID_MAIL_FROM={your-mail-from} | ||
SENDGRID_API_KEY={your-sendgrid-api-key}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a 0th bullet abt installing sendgrid module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
lgtm |
@fenglu-g can you have a look at the travis failure? |
@criccomini could be this be travis flakiness? It failed on one of the settings with the following error message: Link below: https://travis-ci.org/apache/incubator-airflow/builds/293688713?utm_source=github_status&utm_medium=notification. |
Accidentally closed this PR, re-opened. |
@criccomini travis run looks OK now. |
LGTM +1 |
Dear Airflow maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
Add sendgrid email support as a plugin (instead of core component).
Tests
tests.contrib.utils.test_sendgrid
Commits