設置Airflow的電子郵件配置以發送有關錯誤的電子郵件


一 . 配置文件 

  airflow.cfg

[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 = smtp.smtp.smtp.com
smtp_starttls = False
smtp_ssl = True    
# Uncomment and set the user/pass settings if you want to use SMTP AUTH
smtp_user = 郵箱名
smtp_password = smtp_password 
smtp_port = 465
smtp_mail_from = 發件人

smtp_starttls基本上意味着使用TLS
如果要改用SSL,請將此設置設置為False,並將smtp_ssl設置為True。您可能需要smtp_usersmtp_password兩種方法

因為我郵箱在服務器上開通的是SSL傳輸,所以打開了 smtp_ssl

二 . 腳本中配置 

args = {
    'owner': 'airflow',
    'start_date': start_date,
    'email': ['email@163.com'],
    'email_on_failure': True,    #失敗之后再次發送
    'email_on_retry': True,
    'depends_on_past': True,
}

三 . 效果

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM