我已经发现我可以通过环境变量AIRFLOW__EMAIL__EMAIL_BACKEND=airflow.contrib.utils.icecube.airflow_amazon_ses.send_email
这是我在dag.py文件中的代码
default_args = {
'owner': OWNER,'depends_on_past': False,'start_date': START_DATE,'email': [ EMAIL ],'email_on_failure': True,'email_on_retry': False,'on_retry_callback': chat_notificator_fn_builder('Will retry the task',color='yellow',conf=config),'on_failure_callback': chat_notificator_fn_builder('Task failed!',color='red',# https://airflow.apache.org/concepts.html#slas
'sla': timedelta(days=1),'retries': 0,'max_active_runs': 1,'task_concurrency': 1,# https://airflow.readthedocs.io/en/latest/scheduler.html#backfill-and-catchup
'catchup': False,'retry_delay': timedelta(minutes=5),}
dag = DAG(
DAG_NAME,default_args=default_args,description='Scheduled mailtest2 Jupyter notebook',schedule_interval=SCHEDULE_INTERVAL
)
mailtest2_task = JupyterOperator(
task_id='mailtest2_task',source_notebook_path=SOURCE_NOTEBOOK_PATH,output_path=OUTPUT_PATH,retries=0,dag=dag)