Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper committed Dec 2, 2023
1 parent 578f06c commit 854344a
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 293 deletions.
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 and response.status.error_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 and status.error_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 or response.error_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 or response.status.error_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 or response.error_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 or response.error_code != 0:
raise MilvusException(response.code, response.reason, response.error_code)
check_status(response.status)
Loading

0 comments on commit 854344a

Please sign in to comment.