While I am using the Airflow Email Operator, I am facing an issue as shown, below.
I had made all the SMTP configurations and Gmail config too (setting up the 16-character password)
[2019-12-06 06:54:01,024] {{taskinstance.py:1047}} ERROR - [Errno 99] Cannot assign requested address
Can someone tell me what is this error and why it's not sending a mail?
The Code is
from datetime import datetime
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.email_operator import EmailOperator
def print_hello():
return 'Hello world!'
default_args = {
'owner': 'peter',
'start_date':datetime(2018,8,11),
}
dag = DAG('hello_world', description='Simple tutorial DAG',
schedule_interval='* * * * *',
default_args = default_args, catchup=False)
dummy_operator = DummyOperator(task_id='dummy_task', retries=3, dag=dag)
hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)
email = EmailOperator(
task_id='send_email',
to='to@gmail.com',
subject='Airflow Alert',
html_content="""<h3>Email Test</h3> """,
dag=dag
)
email >> dummy_operator >> hello_operator