googleapis / googleapis/python-aiplatform

aiplatform.Model.versioning_registry.delete now raises google.api_core.exceptions.InternalServerError

Open
#2,675 1 comment 0 reactions 0 assignees View on GitHub
api: vertex-ai
Dominant language
Python
Stars
905
Forks
465
Avg merge
1d 13h
Merged PRs (30d)
44

Description

aiplatform.Model.versioning_registry.delete is useful when you want to delete a specific version number of a model. It is raising a new 500 error.

Multiple recent versions of the SDK - 1.27.1, 1.31.1, and 1.33.1 - will still delete a model version, but after the deletion, raise `google.api_core.exceptions.InternalServerError: 500 Internal error encountered.`

To reproduce, you must have a model in the Model Registry with multiple versions. Then do the following:

```
from google.cloud import aiplatform
models = aiplatform.Model.list()
model = models[0] # pick a model with multiple versions
model.versioning_registry.delete_version(2) # pick a version that is not the default
```

Full traceback:

---------------------------------------------------------------------------
_InactiveRpcError Traceback (most recent call last)
File .venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:72, in _wrap_unary_errors..error_remapped_callable(*args, **kwargs)
71 try:
---> 72 return callable_(*args, **kwargs)
73 except grpc.RpcError as exc:

File .venv/lib/python3.10/site-packages/grpc/_channel.py:1030, in _UnaryUnaryMultiCallable.__call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)
1028 state, call, = self._blocking(request, timeout, metadata, credentials,
1029 wait_for_ready, compression)
-> 1030 return _end_unary_response_blocking(state, call, False, None)

File .venv/lib/python3.10/site-packages/grpc/_channel.py:910, in _end_unary_response_blocking(state, call, with_call, deadline)
909 else:
--> 910 raise _InactiveRpcError(state)

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INTERNAL
details = "Internal error encountered."
debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B2607:f8b0:4007:815::200a%5D:443 {created_time:"2023-10-04T17:05:28.288819-07:00", grpc_status:13, grpc_message:"Internal error encountered."}"
>

The above exception was the direct cause of the following exception:

InternalServerError Traceback (most recent call last)
Cell In[8], line 1
----> 1 model.versioning_registry.delete_version(2)

File .venv/lib/python3.10/site-packages/google/cloud/aiplatform/models.py:5057, in ModelRegistry.delete_version(self, version)
5044 def delete_version(
5045 self,
5046 version: str,
5047 ) -> None:
5048 """Deletes a model version from the registry.
5049
5050 Cannot delete a version if it is the last remaining version.
(...)
5054 version (str): Required. The model version ID or alias to delete.
5055 """
-> 5057 lro = self.client.delete_model_version(
5058 name=self._get_versioned_name(self.model_resource_name, version),
5059 )
5061 _LOGGER.info(f"Deleting version {version} for {self.model_resource_name}")
5063 lro.result()

File .venv/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/model_service/client.py:1434, in ModelServiceClient.delete_model_version(self, request, name, retry, timeout, metadata)
1429 metadata = tuple(metadata) + (
1430 gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1431 )
1433 # Send the request.
-> 1434 response = rpc(
1435 request,
1436 retry=retry,
1437 timeout=timeout,
1438 metadata=metadata,
1439 )
1441 # Wrap the response in an operation future.
1442 response = gac_operation.from_gapic(
1443 response,
1444 self._transport.operations_client,
1445 empty_pb2.Empty,
1446 metadata_type=gca_operation.DeleteOperationMetadata,
1447 )

File .venv/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py:113, in _GapicCallable.__call__(self, timeout, retry, *args, **kwargs)
110 metadata.extend(self._metadata)
111 kwargs["metadata"] = metadata
--> 113 return wrapped_func(*args, **kwargs)

File .venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:74, in _wrap_unary_errors..error_remapped_callable(*args, **kwargs)
72 return callable_(*args, **kwargs)
73 except grpc.RpcError as exc:
---> 74 raise exceptions.from_grpc_error(exc) from exc

InternalServerError: 500 Internal error encountered.

Contributor guide

Open the contributing guide

Research direction

Start at aiplatform.Model.versioning_registry.delete_version and the ModelServiceClient.delete_model_version call shown in the traceback. Reproduce with a model that has multiple versions and delete a non-default version. Done means the version is deleted without the reported InternalServerError; determine whether the failure is in the SDK path or the service before changing code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cloud, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.