首页 > 解决方案 > 带有气流的电子邮件

问题描述

我是否必须进行任何其他设置才能让 apache-airflow 向我发送有关任务失败的电子邮件。我的配置文件中有以下内容(未更改默认值):

[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 = airflow@example.com

在我的任务中,我有

'email': ['my.email@domain.co.uk'],
'email_on_failure': True,

但是当任务失败时,它不会向我发送电子邮件。

我看到了这个问题:如何设置 Airflow 的电子邮件配置以发送错误电子邮件?但我真的不明白要从中采取什么行动。我只是在寻找气流发送电子邮件之前需要做什么的基础知识。我是否必须配置我自己的 smtp 服务器,还是应该开箱即用?

我在 CentOS 上运行 apache-airflow 1.9.0

标签: emailsmtpairflow

解决方案


您将需要自己的 SMTP 服务。我们在内部使用 Mailgun 和 Sendgrid,效果很好。您只需要.cfg使用凭据更改这些行,重新启动气流,就可以开始了!


推荐阅读