Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emails with Airflow

Do I have to do any additional setup in order to get apache-airflow to send me emails on task failure. I have the following in my config file (unchanged from the defaults):

[email]
email_backend = airflow.utils.email.send_email_smtp


[smtp]
# If you want airflow to send emails on retries, failure, and you want to use
# the airflow.utils.email.send_email_smtp function, you have to configure an
# smtp server here
smtp_host = localhost
smtp_starttls = True
smtp_ssl = False
# Uncomment and set the user/pass settings if you want to use SMTP AUTH
# smtp_user = airflow
# smtp_password = airflow
smtp_port = 25
smtp_mail_from = [email protected]

and in my task I have

'email': ['[email protected]'],
'email_on_failure': True,

But it is not sending me emails when the task fails.

I have seen this question: How do I setup Airflow's email configuration to send an email on errors? but I didn't really understand what actions to take from it. I'm just looking for the basics on what needs to be done before airflow will send emails. Do I have to configure my own smtp server or should it work out the box?

I'm running apache-airflow 1.9.0 on CentOS

like image 245
Dan Avatar asked Jan 01 '23 22:01

Dan


1 Answers

You'll need your own SMTP service. We use Mailgun and Sendgrid internally and it works pretty well. You'll just need to change those lines in your .cfg with your credentials, restart airflow, and you should be good to go!

like image 96
Viraj Parekh Avatar answered Jan 28 '23 21:01

Viraj Parekh