-
Notifications
You must be signed in to change notification settings - Fork 110
FileNotFoundError Not Being Caught In get_service_data() (token.py) #936
Description
I am trying to use gcloud-aio (9.6.0) to download images from GCS in my Vertex Endpoint before model inference. I am using a custom container built on europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-4:latest (Python 3.9). Vertex uses the metadata server to get application default credentials, so I am simply passing in Token() ( from gcloud.aio.auth import Token) to the Storage() constructor, but a FileNotFoundError at line 137 of token.py:
My understanding is that this should be caught by except CustomFileError on line 146.
I think this might have to do with the logic around CLOUDSDK_CONFIG and/or GOOGLE_APPLICATION_CREDENTIALS - I am checking this now.
If you could help me understand what's going and help me to get this working, I would be grateful as I am presently stuck.
It would be very nice to be able to for credentials to be loaded from the metadata server.
Update: I can confirm the issue is that the CLOUDSDK_CONFIG is set by default in the Vertex base image which means your auth logic will never work for custom Vertex AI Endpoint containers when trying to authenticate using the metadata server - why do we do set_explicitly = bool(cloudsdk_config) and then raise if set_explicitly is not None? Could we remove this logic?