보통 이 ERROR는 LOGS 폴더에 대한 권한 문제이거나 메모리 사용량 문제일 경우도 있는데 나는 그 두 케이스에 해당되지 않았다.
테스트를 위해 짧은 간격으로 스케줄을 걸어 확인했을 때는 정상 작동하는 경우도 있고 작동하지 않고 LOGS 하위 폴더에 log 파일도 생성하지 않는 경우도 있다.
Airflow UI 내 log
*** Could not read served logs: Request URL is missing an 'http://' or 'https://' protocol.
Airflow_Webserver.log
[2024-03-27 09:33:32 +0900] [3098307] [WARNING] Invalid request from ip=192.168.21.145: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:2633)
[[34m2024-03-27T09:33:32.142+0900[0m] {[34mfile_task_handler.py:[0m568} ERROR[0m - Could not read served logs[0m
Traceback (most recent call last):
File "/app/airflow/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/app/airflow/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/app/airflow/httpcore/_sync/connection_pool.py", line 208, in handle_request
raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/airflow/airflow/utils/log/file_task_handler.py", line 546, in _read_from_logs_server
response = _fetch_logs_from_service(url, rel_path)
File "/app/airflow/airflow/utils/log/file_task_handler.py", line 92, in _fetch_logs_from_service
response = httpx.get(
File "/app/airflow/httpx/_api.py", line 189, in get
return request(
File "/app/airflow/httpx/_api.py", line 100, in request
return client.request(
File "/app/airflow/httpx/_client.py", line 821, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/app/airflow/httpx/_client.py", line 908, in send
response = self._send_handling_auth(
File "/app/airflow/httpx/_client.py", line 936, in _send_handling_auth
response = self._send_handling_redirects(
File "/app/airflow/httpx/_client.py", line 973, in _send_handling_redirects
response = self._send_single_request(request)
File "/app/airflow/httpx/_client.py", line 1009, in _send_single_request
response = transport.handle_request(request)
File "/app/airflow/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/usr/lib64/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/app/airflow/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
개발 환경은 서버 1개, DB 1개라 문제가 없는데
지금 문제는 프로덕션 환경에서 서버 2개, DB 1개일 때에 해당된다.
서버 1번 ) webaserver 및 scheduler 기동 중 DAG 생성 완료
서버 2번 ) 서버 1과 같은 세팅 완료. DAG만 없음 ( webaserver 및 scheduler 기동 중 )
AIRFLOW는 서버가 다르더라도 DB 메타 데이터 기준으로 WORKER들을 생성한다.
1번 서버에 5분 간격으로 실행하는 DAG를 업로드하였으나
2번에는 DAG는 없이 WORKER만 보내진 격이니 에러를 뱉어낼 수 밖에!
생각도 못했던 2번 서버 LOGS 하위 폴더에 log 파일이 생성되어 있었다.
[2024-03-27T13:02:00.691+0900] {scheduler_job_runner.py:781} ERROR -
Executor reports task instance <TaskInstance: scheduled__2024-03-27T04:00:00+00:00
[queued]> finished (failed) although the task says it's queued. (Info: None) Was the task killed externally?
2번 서버 스케줄러 중단하니 말끔하게 처리ㅠ
혹은 2번 서버에도 DAG를 넣어주면 된다.
요약) 서버는 달라도 DB 기준으로 실제 WORK가 작동하고 DAG는 각각의 서버에서 관리된다.
'etc' 카테고리의 다른 글
[Airflow] 샘플 DAG 삭제 (0) | 2024.03.27 |
---|---|
[Linux] 웹개발 자주 쓰는 명령어 (0) | 2023.07.01 |
port 번호로 PID 찾아서 실행 종료하기 (0) | 2022.11.15 |
나에게 필요한 서적 (자료구조/알고리즘/프로그래머적 사고) (0) | 2022.09.14 |
[강의 회고] 스프링 입문 강의를 마치며 (0) | 2022.09.10 |