Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#7908] improvement(python-client): Support passing custom configuration for python GVFS client. (#8333)

Mini Yu5c00ae7418bc
diff --git a/clients/client-python/gravitino/filesystem/gvfs.py b/clients/client-python/gravitino/filesystem/gvfs.py
index 48cdd0e859..3e8a9a4559 100644
--- a/clients/client-python/gravitino/filesystem/gvfs.py
+++ b/clients/client-python/gravitino/filesystem/gvfs.py
@@ -70,6 +70,7 @@ class GravitinoVirtualFileSystem(fsspec.AbstractFileSystem):
:param options: Options for the GravitinoVirtualFileSystem
:param kwargs: Extra args for super filesystem
"""
+ self._kwargs = dict(kwargs)
self._hook = self._get_hook_class(options)
self._hook.initialize(options)
self._operations = self._get_gvfs_operations_class(
@@ -459,6 +460,7 @@ class GravitinoVirtualFileSystem(fsspec.AbstractFileSystem):
server_uri=server_uri,
metalake_name=metalake_name,
options=options,
+ **self._kwargs,
)
diff --git a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
index 85b74d6ddd..ce57a7a781 100644
--- a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
+++ b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
@@ -161,6 +161,7 @@ class BaseGVFSOperations(ABC):
)
)
self._current_location_name = self._init_current_location_name()
+ self._kwargs = kwargs
@property
def current_location_name(self):
@@ -531,6 +532,7 @@ class BaseGVFSOperations(ABC):
fileset_catalog.properties(),
self._options,
actual_file_location,
+ **self._kwargs,
)
self._filesystem_cache[(name_identifier, location_name)] = new_cache_value
return new_cache_value[1]
diff --git a/clients/client-python/tests/integration/test_gvfs_with_s3.py b/clients/client-python/tests/integration/test_gvfs_with_s3.py
index 20200234b6..76c56e7c35 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_s3.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_s3.py
@@ -114,7 +114,9 @@ class TestGvfsWithS3(TestGvfsWithHDFS):
name=cls.metalake_name, comment="", properties={}
)
cls.gravitino_client = GravitinoClient(
- uri="http://localhost:8090", metalake_name=cls.metalake_name
+ uri="http://localhost:8090",
+ metalake_name=cls.metalake_name,
+ client_config={"gravitino_client_request_timeout": 180},
)
cls.config = {}
@@ -264,6 +266,7 @@ class TestGvfsWithS3(TestGvfsWithHDFS):
fs.rm_file(rmdir_file)
+ # pylint: disable=W0212
def test_mkdir(self):
mkdir_dir = self.fileset_gvfs_location + "/test_mkdir"
mkdir_actual_dir = self.fileset_storage_location + "/test_mkdir"
@@ -271,9 +274,15 @@ class TestGvfsWithS3(TestGvfsWithHDFS):
server_uri="http://localhost:8090",
metalake_name=self.metalake_name,
options=self.options,
+ config_kwargs={"s3": {"addressing_style": "virtual"}},
**self.conf,
)
+ fs.operations._catalog_cache.clear()
+ s3_fs = fs.operations._get_actual_filesystem(mkdir_dir, None)
+ config_kwargs = s3_fs.config_kwargs
+ self.assertEqual("virtual", config_kwargs.get("s3").get("addressing_style"))
+
# it actually takes no effect.
self.check_mkdir(mkdir_dir, mkdir_actual_dir, fs)