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: Fix compactibility of exception with Milvus 2.2.x #1805

Merged
merged 9 commits into from
Dec 3, 2023
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
31 changes: 9 additions & 22 deletions pymilvus/client/asynch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .abstract import MutationResult, SearchResult
from .types import Status
from .utils import check_status


# TODO: remove this to a common util
Expand Down Expand Up @@ -162,28 +163,19 @@ def exception(self):

class SearchFuture(Future):
def on_response(self, response: milvus_pb2.SearchResults):
if response.status.code == 0:
return SearchResult(response.results)

status = response.status
raise MilvusException(status.code, status.reason, status.error_code)
check_status(response.status)
return SearchResult(response.results)


class MutationFuture(Future):
def on_response(self, response: Any):
status = response.status
if status.code == 0:
return MutationResult(response)

status = response.status
raise MilvusException(status.code, status.reason, status.error_code)
check_status(response.status)
return MutationResult(response)


class CreateIndexFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
raise MilvusException(response.code, response.reason, response.error_code)

check_status(response)
return Status(response.code, response.reason)


Expand Down Expand Up @@ -244,19 +236,14 @@ def exception(self):

class FlushFuture(Future):
def on_response(self, response: Any):
if response.status.code != 0:
raise MilvusException(
response.status.code, response.status.reason, response.status.error_code
)
check_status(response.status)


class LoadCollectionFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
raise MilvusException(response.code, response.reason, response.error_code)
check_status(response.status)


class LoadPartitionsFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
raise MilvusException(response.code, response.reason, response.error_code)
check_status(response.status)
Loading
Loading