You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/09/11 17:06:36 UTC
[airflow] branch v2-4-test updated: Properly build URL to retrieve logs independently from system (#26337)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-4-test by this push:
new 6f24836e5e Properly build URL to retrieve logs independently from system (#26337)
6f24836e5e is described below
commit 6f24836e5ee56c452947aa87f84a21dd4f8eb87c
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Sun Sep 11 19:05:06 2022 +0200
Properly build URL to retrieve logs independently from system (#26337)
The previous way of building the path depended on the OS path
but it was really used to build the URL so we should use
urllib instead of os.path.join.
(cherry picked from commit 18386026c28939fa6d91d198c5489c295a05dcd2)
---
airflow/utils/log/file_task_handler.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/airflow/utils/log/file_task_handler.py b/airflow/utils/log/file_task_handler.py
index d2beb54c5f..0435912476 100644
--- a/airflow/utils/log/file_task_handler.py
+++ b/airflow/utils/log/file_task_handler.py
@@ -21,6 +21,7 @@ import os
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Optional
+from urllib.parse import urljoin
from airflow.configuration import AirflowConfigException, conf
from airflow.exceptions import RemovedInAirflow3Warning
@@ -194,8 +195,8 @@ class FileTaskHandler(logging.Handler):
else:
import httpx
- url = os.path.join("http://{ti.hostname}:{worker_log_server_port}/log", log_relative_path).format(
- ti=ti, worker_log_server_port=conf.get('logging', 'WORKER_LOG_SERVER_PORT')
+ url = urljoin(
+ f"http://{ti.hostname}:{conf.get('logging', 'WORKER_LOG_SERVER_PORT')}/log", log_relative_path
)
log += f"*** Log file does not exist: {location}\n"
log += f"*** Fetching from: {url}\n"