-
Notifications
You must be signed in to change notification settings - Fork 350
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
fix: Set prediction client when listing Endpoints #512
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR should also include a test to confirm the fix. Thanks!
google/cloud/aiplatform/models.py
Outdated
|
||
endpoint._gca_resource = gapic_resource | ||
endpoint._prediction_client = self._instantiate_prediction_client( | ||
location=location or initializer.global_config.location, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized there is a bug here and in the implementation it's based on:
If passed a full resource name that doesn't match location
or init.location
then will instantiate the client in the incorrect location.
Please change this here and in the reference above to the use the constructed endpoint resource's location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added calls to _get_and_validate_project_location()
in both Endpoint.__init__()
and Endpoint._construct_sdk_resource_from_gapic()
to allow the full resource name to override location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I realized that downstream calls in VertexAiResourceNounWithFutureManager._empty_constructor()
and VertexAiResourceNounWithFutureManager.__init__()
already call _get_and_validate_project_location()
.
I've updated the call to _instantiate_prediction_client()
to use the location set by those methods instead of the location
argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Thanks, Vinny!
* fix: Set prediction client when listing Endpoints * Address reviewer comments * Remove redundant init() in TestEndpoints * Update location passed to _instantiate_prediction_client()
Overrides
VertexAiResourceNounWithFutureManager._construct_sdk_resource_from_gapic
withEndpoint._construct_sdk_resource_from_gapic
.Subclass method initializes the Prediction service client, allowing users to call
predict()
/explain()
on anEndpoint
returned by a call tolist()
Fixes b/192002630 🦕