Skip to content

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

[#8969] fix(client-python): fix fileset test with GCS in python module (#9012)

Mini Yuf35496a01ac3
diff --git a/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py b/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py
index ae476a75a9..842260403e 100644
--- a/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py
+++ b/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import importlib
+import logging
import sys
import time
from abc import ABC, abstractmethod
@@ -42,6 +43,8 @@ from gravitino.filesystem.gvfs_config import GVFSConfig
TIME_WITHOUT_EXPIRATION = sys.maxsize
SLASH = "/"
+logger = logging.getLogger(__name__)
+
class StorageType(Enum):
HDFS = "hdfs"
@@ -103,6 +106,10 @@ class StorageHandler(ABC):
entry["name"], fileset_location, gvfs_path_prefix
)
last_modified = self._get_last_modified(entry)
+ if last_modified is None:
+ logger.info(
+ "The last modified time is %s for %s", last_modified, fileset_location
+ )
return {
"name": path,
"size": entry["size"],
@@ -189,7 +196,7 @@ class StorageHandler(ABC):
return actual_path
def _get_last_modified(self, entry: Dict):
- return entry["mtime"]
+ return entry["mtime"] if "mtime" in entry else None
class LocalStorageHandler(StorageHandler):
diff --git a/clients/client-python/tests/integration/test_gvfs_with_gcs.py b/clients/client-python/tests/integration/test_gvfs_with_gcs.py
index b3db3db27a..e2d1bfa0d8 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_gcs.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_gcs.py
@@ -283,8 +283,7 @@ class TestGvfsWithGCS(TestGvfsWithHDFS):
mkdir_dir = mkdir_dir.replace(self.bucket_name, new_bucket)
mkdir_actual_dir = mkdir_actual_dir.replace(self.bucket_name, new_bucket)
- with self.assertRaises(OSError):
- fs.mkdir(mkdir_dir, create_parents=True)
+ fs.mkdir(mkdir_dir, create_parents=True)
self.assertFalse(self.fs.exists(mkdir_actual_dir))
def test_makedirs(self):
diff --git a/clients/client-python/tests/integration/test_gvfs_with_hdfs.py b/clients/client-python/tests/integration/test_gvfs_with_hdfs.py
index 976e452508..a0f36d57eb 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_hdfs.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_hdfs.py
@@ -216,7 +216,9 @@ class TestGvfsWithHDFS(IntegrationTestEnv):
@classmethod
def _clean_test_data(cls):
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},
)
catalog = cls.gravitino_client.load_catalog(name=cls.catalog_name)