Skip to content

Commit

Permalink
fix: Allow non-lro delete method
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 640765520
  • Loading branch information
Zhenyi Qi authored and copybara-github committed Jun 6, 2024
1 parent 70168eb commit c23c0ad
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions google/cloud/aiplatform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,12 +1199,16 @@ def _list_with_local_order(
def _delete(self) -> None:
"""Deletes this Vertex AI resource. WARNING: This deletion is permanent."""
_LOGGER.log_action_start_against_resource("Deleting", "", self)
lro = getattr(self.api_client, self._delete_method)(name=self.resource_name)
_LOGGER.log_action_started_against_resource_with_lro(
"Delete", "", self.__class__, lro
possible_lro = getattr(self.api_client, self._delete_method)(
name=self.resource_name
)
lro.result()
_LOGGER.log_action_completed_against_resource("deleted.", "", self)

if possible_lro:
_LOGGER.log_action_started_against_resource_with_lro(
"Delete", "", self.__class__, possible_lro
)
possible_lro.result()
_LOGGER.log_action_completed_against_resource("deleted.", "", self)


class VertexAiResourceNounWithFutureManager(_VertexAiResourceNounPlus, FutureManager):
Expand Down

0 comments on commit c23c0ad

Please sign in to comment.