-
Notifications
You must be signed in to change notification settings - Fork 354
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
feat: Lazy load Endpoint class #655
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.
Couple of thoughts:
-
It seems like we don't get the benefit of lazy loading because at predict time we're making the
get
call throughpredict
->self.resource_name
->self._sync_gca_resource
->self._sync_gca_resource_if_skipped
-
Perhaps a simpler implementation is to populate
_gca_resource
in the constructor like so:
endpoint_name = utils.full_resource_name(...)
self._gca_resource = gca_endpoint.Endpoint(name=endpoint_name)
- Please extend the integration test to retrieve one of the created models, predict, and assert we didn't get the resource.
google/cloud/aiplatform/models.py
Outdated
endpoint._endpoint_name = endpoint._gca_resource.name | ||
|
||
# Building Endpoint from GAPIC object is equivalent to calling getter | ||
endpoint._skipped_getter_call = False |
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 creating a new instance attribute but _skipped_getter_call
is defined as a class attribute above. Perhaps, _skipped_getter_call
should be an instance attribute?
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.
Thanks Vinny! I added one comment that may simplify this change.
Fixes b/194435202 🦕