【发布时间】:2020-02-28 05:03:15
【问题描述】:
我让 Airflow 与 CeleryExecutor 和 2 名工作人员一起运行。当我的 DAG 运行时,这些任务会在运行它们的工作人员的文件系统上生成一个日志。但是当我转到 Web UI 并单击任务日志时,我得到:
*** Log file does not exist: /usr/local/airflow/logs/test_dag/task2/2019-11-01T18:12:16.309655+00:00/1.log
*** Fetching from: http://70953abf1c10:8793/log/test_dag/task2/2019-11-01T18:12:16.309655+00:00/1.log
*** Failed to fetch log file from worker. HTTPConnectionPool(host='70953abf1c10', port=8793): Max retries exceeded with url: /log/test_dag/task2/2019-11-01T18:12:16.309655+00:00/1.log (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f329c3a2650>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
http://70953abf1c10:8793/ 显然不是 worker 的正确 IP。然而,celery@70953abf1c10 是这个工人在 Celery 中的名字。似乎 Airflow 正在尝试从 Celery 学习工作人员的 URL,但 Celery 正在提供工作人员的姓名。我该如何解决这个问题?
【问题讨论】:
-
这实际上是两个独立的错误。第一个错误是找不到日志文件。第二个错误是当它尝试通过 HTTP 获取日志文件时。到目前为止的答案试图解决第二个问题。但是通过为每个容器安装一个共享的 docker 卷可能更容易解决第一个问题。见stackoverflow.com/a/67741414/1004759