Skip to content
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: add self.wait() in operations after optional_sync supported resource creation #1083

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ def deploy_index(
MatchingEngineIndexEndpoint - IndexEndpoint resource object
"""

self.wait()

_LOGGER.log_action_start_against_resource(
"Deploying index", "index_endpoint", self,
)
Expand Down Expand Up @@ -591,6 +593,8 @@ def undeploy_index(
MatchingEngineIndexEndpoint - IndexEndpoint resource object
"""

self.wait()

_LOGGER.log_action_start_against_resource(
"Undeploying index", "index_endpoint", self,
)
Expand Down Expand Up @@ -652,6 +656,8 @@ def mutate_deployed_index(
Optional. Strings which should be sent along with the request as metadata.
"""

self.wait()

_LOGGER.log_action_start_against_resource(
"Mutating index", "index_endpoint", self,
)
Expand Down Expand Up @@ -691,6 +697,7 @@ def deployed_indexes(
Returns:
List[gca_matching_engine_index_endpoint.DeployedIndex] - Deployed indexes
"""
self._assert_gca_resource_is_available()
return self._gca_resource.deployed_indexes

@base.optional_sync()
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/aiplatform/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ def update(
ValueError: If `labels` is not the correct format.
"""

self.wait()

current_model_proto = self.gca_resource
copied_model_proto = current_model_proto.__class__(current_model_proto)

Expand Down Expand Up @@ -2496,6 +2498,8 @@ def export_model(
ValueError: If invalid arguments or export formats are provided.
"""

self.wait()

# Model does not support exporting
if not self.supported_export_formats:
raise ValueError(f"The model `{self.resource_name}` is not exportable.")
Expand Down