Skip to content

fix: remote_base path in HdfsRemoteLogIO (remove schema from path) #51207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
**(
{
"base_log_folder": BASE_LOG_FOLDER,
"remote_base": remote_base_log_folder,
"remote_base": urlsplit(remote_base_log_folder).path,
"delete_local_copy": delete_local_copy,
}
| remote_task_handler_kwargs
Expand Down
3 changes: 2 additions & 1 deletion airflow-core/tests/unit/core/test_logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ def test_loading_remote_logging_with_hdfs_handler(self):
{
("logging", "remote_logging"): "True",
("logging", "remote_log_conn_id"): "some_hdfs",
("logging", "remote_base_log_folder"): "hdfs://some-folder",
("logging", "remote_base_log_folder"): "hdfs://some-folder/log",
}
):
importlib.reload(airflow_local_settings)
airflow.logging_config.configure_logging()

assert isinstance(airflow.logging_config.REMOTE_TASK_LOG, HdfsRemoteLogIO)
assert getattr(airflow.logging_config.REMOTE_TASK_LOG, "remote_base") == "/log"
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, base_log_folder: str, hdfs_log_folder: str, **kwargs):
self.upload_on_close = True

self.io = HdfsRemoteLogIO(
remote_base=hdfs_log_folder,
remote_base=self.remote_base,
base_log_folder=base_log_folder,
delete_local_copy=kwargs.get(
"delete_local_copy", conf.getboolean("logging", "delete_local_logs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,6 @@ def test_close_with_delete_local_logs_conf(
assert handler.upload_on_close
handler.close()
assert os.path.exists(handler.handler.baseFilename) == expected_existence_of_local_copy

def test_correct_path_for_hdfs_log(self, ti):
assert self.hdfs_task_handler.io.remote_base == "/remote/log/location"
Loading