How do I setup Airflow's email configuration to send an email on errors?

你说的曾经没有我的故事 提交于 2019-12-01 05:10:56

smtp_starttls basically means Use TLS

Set this to False and set smtp_ssl to True if you want to use SSL instead. You probably need smtp_user and smtp_password for either.

Airflow will not handle 2 step authentication. However, is you are using AWS you likely don't need it as your SMTP (SES) credentials are different from your AWS credentials.

See here.

EDIT: For airflow to send an email on failure, there are a couple things that need to be set on your task, email_on_failure and email.

See here for example:

def throw_error(**context):
    raise ValueError('Intentionally throwing an error to send an email.')



t1 = PythonOperator(task_id='throw_error_and_email',
                    python_callable=throw_error,
                    provide_context=True,
                    email_on_failure=True,
                    email='your.email@whatever.com',
                    dag=dag)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!