Email Operator로 메일 전송하기 실패
774
작성한 질문수 2
Email Operator로 메일 전송하기 강의 실습을 진행하다가 에러가 나서 질문 남깁니다.
dag 실행 로그가 아래와 같이 찍히고, 실패 하는데 어떤 부분이 잘못되어서 이런 건지 모르겠습니다...
[2023-11-15, 14:06:59 UTC] {warnings.py:109} WARNING - /home/***/.local/lib/python3.8/site-packages/***/utils/email.py:154: RemovedInAirflow3Warning: Fetching SMTP credentials from configuration variables will be deprecated in a future release. Please set credentials using a connection instead.
[2023-11-15, 14:06:59 UTC] {configuration.py:1050} WARNING - section/key [smtp/smtp_user] not found in config
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1937} ERROR - Task failed with exception
[2023-11-15, 14:06:59 UTC] {standard_task_runner.py:104} ERROR - Failed to execute job 73 for task send_email_task ([Errno 99] Cannot assign requested address; 618)
답변 1
0
안녕하세요 지수님
올려주신것만으로는 판단이 어려운데, 원인을 확인하려면
dag내용이랑 에러 전체로그, connection 을 어떻게 등록하셨는지 올려주시겠어요?
0
넵 이렇게 드리면 될까요??
dag 내용
import datetime
import pendulum
from airflow import DAG
from airflow.operators.email import EmailOperator
with DAG(
dag_id="dags_email_operator",
schedule="0 8 1 * *",
start_date=pendulum.datetime(2023, 3, 1, tz="Asia/Seoul"),
catchup=False
) as dag:
send_email_task = EmailOperator(
task_id="send_email_task",
to="jjoo4956@naver.com",
subject="Airflow 성공 메일",
html_content="Airflow 작업이 완료되었습니다."
)
에러 전체로그
2df86e82d8c2
*** Found local files:
*** * /opt/airflow/logs/dag_id=dags_email_operator/run_id=manual__2023-11-15T14:06:57.712917+00:00/task_id=send_email_task/attempt=1.log
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1159} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: dags_email_operator.send_email_task manual__2023-11-15T14:06:57.712917+00:00 [queued]>
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1159} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: dags_email_operator.send_email_task manual__2023-11-15T14:06:57.712917+00:00 [queued]>
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1361} INFO - Starting attempt 1 of 1
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1382} INFO - Executing <Task(EmailOperator): send_email_task> on 2023-11-15 14:06:57.712917+00:00
[2023-11-15, 14:06:59 UTC] {standard_task_runner.py:57} INFO - Started process 618 to run task
[2023-11-15, 14:06:59 UTC] {standard_task_runner.py:84} INFO - Running: ['***', 'tasks', 'run', 'dags_email_operator', 'send_email_task', 'manual__2023-11-15T14:06:57.712917+00:00', '--job-id', '73', '--raw', '--subdir', 'DAGS_FOLDER/dags_email_operator.py', '--cfg-path', '/tmp/tmpa9vg4uqd']
[2023-11-15, 14:06:59 UTC] {standard_task_runner.py:85} INFO - Job 73: Subtask send_email_task
[2023-11-15, 14:06:59 UTC] {task_command.py:416} INFO - Running <TaskInstance: dags_email_operator.send_email_task manual__2023-11-15T14:06:57.712917+00:00 [running]> on host 2df86e82d8c2
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1662} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='***' AIRFLOW_CTX_DAG_ID='dags_email_operator' AIRFLOW_CTX_TASK_ID='send_email_task' AIRFLOW_CTX_EXECUTION_DATE='2023-11-15T14:06:57.712917+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2023-11-15T14:06:57.712917+00:00'
[2023-11-15, 14:06:59 UTC] {warnings.py:109} WARNING - /home/***/.local/lib/python3.8/site-packages/***/utils/email.py:154: RemovedInAirflow3Warning: Fetching SMTP credentials from configuration variables will be deprecated in a future release. Please set credentials using a connection instead.
send_mime_email(e_from=mail_from, e_to=recipients, mime_msg=msg, conn_id=conn_id, dryrun=dryrun)
[2023-11-15, 14:06:59 UTC] {configuration.py:1050} WARNING - section/key [smtp/smtp_user] not found in config
[2023-11-15, 14:06:59 UTC] {email.py:270} INFO - Email alerting: attempt 1
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1937} ERROR - Task failed with exception
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/operators/email.py", line 77, in execute
send_email(
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/email.py", line 80, in send_email
return backend(
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/email.py", line 154, in send_email_smtp
send_mime_email(e_from=mail_from, e_to=recipients, mime_msg=msg, conn_id=conn_id, dryrun=dryrun)
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/email.py", line 272, in send_mime_email
smtp_conn = _get_smtp_connection(smtp_host, smtp_port, smtp_timeout, smtp_ssl)
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/email.py", line 316, in _get_smtp_connection
return smtplib.SMTP(host=host, port=port, timeout=timeout)
File "/usr/local/lib/python3.8/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
File "/usr/local/lib/python3.8/smtplib.py", line 339, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/local/lib/python3.8/smtplib.py", line 310, in _get_socket
return socket.create_connection((host, port), timeout,
File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address
[2023-11-15, 14:06:59 UTC] {taskinstance.py:1400} INFO - Marking task as FAILED. dag_id=dags_email_operator, task_id=send_email_task, execution_date=20231115T140657, start_date=20231115T140659, end_date=20231115T140659
[2023-11-15, 14:06:59 UTC] {standard_task_runner.py:104} ERROR - Failed to execute job 73 for task send_email_task ([Errno 99] Cannot assign requested address; 618)
[2023-11-15, 14:07:00 UTC] {local_task_job_runner.py:228} INFO - Task exited with return code 1
[2023-11-15, 14:07:00 UTC] {taskinstance.py:2778} INFO - 0 downstream tasks scheduled from follow-on schedule check
docker-compose.yaml
pykrx 회원제 전환으로 인한 실습 불가
0
103
2
수료증 발급
0
78
3
에러 발생 관련 질문드립니다.
0
77
2
vscode 작업화면에 오류가 발생하지 않습니다.
0
68
2
plugins 폴더 생성
0
73
2
WSL에서 git push 가 안되요 ㅠ
0
107
2
chatGPT&Airflow로 블로그 자동 포스팅하기 는 Deprecated 가 필요합니다.
0
65
2
github에 회원가입이 안되는데 원인이 뭔지 모르겠어요 ㅠ
0
705
2
설치중인데 venv를 꼭 써야할까요?
0
119
2
설치 버전 관련 질문입니다.
0
66
1
우분투 버전 다운받아야하는데 어떤걸로 설치해야할까요?
0
60
1
DAG 만들기 중 airflow 패키지 로드 에러
0
104
2
3.0에서도 수업노트가 성립하는지 확인 부탁드립니다!
0
94
3
task_id 사용법이 뭔가 바뀐 것 같습니다.
0
75
3
email operator 오류 관련
0
63
2
plugins 폴더 관련
0
91
2
bash operator 관련 문의입니다
0
77
3
스케쥴러 - DAG 파싱 부하 줄이는 과정 질문
0
78
2
Dags refresh 주기 관련 질문
0
123
2
wsl 관련 질문입니다.!
0
72
2
macOS에서 docker 설치
0
92
2
템플릿 변수에 대한 오류
0
58
2
custom_image 디렉토리 문의드립니다.
0
51
2
ETL 인터뷰 관련 문의
0
100
2





