Skip to content

Commit

Permalink
Remind users when unimplemented feature was called (#1486)
Browse files Browse the repository at this point in the history
Signed-off-by: longjiquan <[email protected]>
  • Loading branch information
longjiquan authored May 30, 2023
1 parent 6e88d3e commit 8926c67
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
AmbiguousIndexName,
)

from ..decorators import retry_on_rpc_failure, ignore_unimplemented
from ..decorators import retry_on_rpc_failure, upgrade_reminder
from . import entity_helper


Expand Down Expand Up @@ -1408,7 +1408,7 @@ def _check():
_check()

@retry_on_rpc_failure()
@ignore_unimplemented(0)
@upgrade_reminder
def __internal_register(self, user, host) -> int:
req = Prepare.register_request(user, host)
response = self._stub.Connect(request=req)
Expand Down
16 changes: 16 additions & 0 deletions pymilvus/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,19 @@ def handler(*args, **kwargs):
raise e
return handler
return wrapper


def upgrade_reminder(func):
@functools.wraps(func)
def handler(*args, **kwargs):
try:
return func(*args, **kwargs)
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.UNIMPLEMENTED:
msg = "this version of sdk is incompatible with server, please downgrade your sdk or upgrade your " \
"server "
raise MilvusException(message=msg) from e
raise e
except Exception as e:
raise e
return handler

0 comments on commit 8926c67

Please sign in to comment.