Skip to content

Commit 79aeec1

Browse files
morganduparthea
andauthored
fix: add self.wait() in operations after optional_sync supported resource creation (#1083)
Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent b7a5177 commit 79aeec1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py

+7
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ def deploy_index(
535535
MatchingEngineIndexEndpoint - IndexEndpoint resource object
536536
"""
537537

538+
self.wait()
539+
538540
_LOGGER.log_action_start_against_resource(
539541
"Deploying index", "index_endpoint", self,
540542
)
@@ -591,6 +593,8 @@ def undeploy_index(
591593
MatchingEngineIndexEndpoint - IndexEndpoint resource object
592594
"""
593595

596+
self.wait()
597+
594598
_LOGGER.log_action_start_against_resource(
595599
"Undeploying index", "index_endpoint", self,
596600
)
@@ -652,6 +656,8 @@ def mutate_deployed_index(
652656
Optional. Strings which should be sent along with the request as metadata.
653657
"""
654658

659+
self.wait()
660+
655661
_LOGGER.log_action_start_against_resource(
656662
"Mutating index", "index_endpoint", self,
657663
)
@@ -691,6 +697,7 @@ def deployed_indexes(
691697
Returns:
692698
List[gca_matching_engine_index_endpoint.DeployedIndex] - Deployed indexes
693699
"""
700+
self._assert_gca_resource_is_available()
694701
return self._gca_resource.deployed_indexes
695702

696703
@base.optional_sync()

google/cloud/aiplatform/models.py

+4
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,8 @@ def update(
15751575
ValueError: If `labels` is not the correct format.
15761576
"""
15771577

1578+
self.wait()
1579+
15781580
current_model_proto = self.gca_resource
15791581
copied_model_proto = current_model_proto.__class__(current_model_proto)
15801582

@@ -2496,6 +2498,8 @@ def export_model(
24962498
ValueError: If invalid arguments or export formats are provided.
24972499
"""
24982500

2501+
self.wait()
2502+
24992503
# Model does not support exporting
25002504
if not self.supported_export_formats:
25012505
raise ValueError(f"The model `{self.resource_name}` is not exportable.")

0 commit comments

Comments
 (0)