代码之家  ›  专栏  ›  技术社区  ›  Dan fatihk

有气流的电子邮件

  •  2
  • Dan fatihk  · 技术社区  · 8 年前

    我是否需要做任何额外的设置,以便让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,
    

    但它不会在任务失败时给我发邮件。

    我见过这个问题: How do I setup Airflow's email configuration to send an email on errors?

    2 回复  |  直到 8 年前
        1
  •  7
  •   Viraj Parekh    8 年前

    您将需要自己的SMTP服务。我们在内部使用Mailgun和Sendgrid,效果很好。你只需要在你的房间里改变那些台词 .cfg 凭你的证件,重新启动气流,你应该可以走了!

        2
  •  2
  •   Kannappan Sirchabesan Picarus    7 年前

    https://github.com/apache/airflow/blob/master/airflow/contrib/utils/sendgrid.py

    然后按照链接中提到的说明操作。

        0. include sendgrid subpackage as part of your Airflow installation, e.g.,
        pip install apache-airflow[sendgrid] 
    
        1. update [email] backend in airflow.cfg, i.e.,
        [email]
        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}.
    
    推荐文章