yuqi1129 commented on code in PR #10317:
URL: https://github.com/apache/gravitino/pull/10317#discussion_r2908836119


##########
clients/client-python/gravitino/filesystem/gvfs_storage_handler.py:
##########
@@ -403,10 +412,50 @@ def get_filesystem_with_expiration(
                     catalog_props,
                 )
                 if isinstance(credential, GCSTokenCredential):
+                    if not GOOGLE_AUTH_AVAILABLE:
+                        raise GravitinoRuntimeException(
+                            "Failed to import google.auth. "
+                            "Please ensure google-auth is installed."
+                        )
+
+                    # gcsfs expects a google.auth.credentials.Credentials 
object
+                    # We need to create a credentials object from the access 
token
+                    class StaticCredentials(Credentials):
+                        """A credentials object that uses a static access 
token."""
+
+                        def __init__(self, token_value, expiry_time_ms):
+                            super().__init__()
+                            self.token = token_value
+                            # Convert milliseconds to datetime
+                            self.expiry = datetime.fromtimestamp(
+                                expiry_time_ms / 1000.0, tz=timezone.utc
+                            )
+
+                        def refresh(self, request):
+                            # Static token cannot be refreshed
+                            raise RuntimeError(

Review Comment:
   `Credentials.refresh()` callers in google-auth/gcsfs typically expect a 
`google.auth.exceptions.RefreshError` (or an `AuthError`) on refresh failures. 
Raising a generic `RuntimeError` here can bypass expected handling paths; 
please consider raising `RefreshError` instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to