Merge pull request #2211 from XuPeng-SH/master

[skip ci]: fix #2210
This commit is contained in:
XuPeng-SH 2020-04-30 23:49:25 +08:00 committed by GitHub
commit adccd3dbf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -83,3 +83,9 @@ def DBErrorHandler(err):
def InvalidArgumentErrorHandler(err):
logger.error(err)
return resp_handler(err, status_pb2.ILLEGAL_RANGE)
@server.errorhandler(exceptions.ConnectionNotFoundError)
def InvalidArgumentErrorHandler(err):
logger.error(err)
return resp_handler(err, status_pb2.UNEXPECTED_ERROR)

View File

@ -17,8 +17,19 @@ class RouterMixin:
return conn.conn
def query_conn(self, name, metadata=None):
conn = self.readonly_topo.get_group(name).get(name).fetch()
if not name:
raise exceptions.ConnectionNotFoundError(
message=f'Conn Group is Empty. Please Check your configurations',
metadata=metadata)
group = self.readonly_topo.get_group(name)
if not group:
raise exceptions.ConnectionNotFoundError(
message=f'Conn Group {name} is Empty. Please Check your configurations',
metadata=metadata)
conn = group.get(name).fetch()
if not conn:
raise exceptions.ConnectionNotFoundError(name, metadata=metadata)
raise exceptions.ConnectionNotFoundError(
message=f'Conn {name} Not Found', metadata=metadata)
conn.on_connect(metadata=metadata)
return conn

View File

@ -8,6 +8,7 @@ from urllib.parse import urlparse
from functools import wraps
from concurrent import futures
from grpc._cython import cygrpc
import milvus
from milvus.grpc_gen.milvus_pb2_grpc import add_MilvusServiceServicer_to_server
from mishards.grpc_utils import is_grpc_method
from mishards.service_handler import ServiceHandler
@ -109,6 +110,8 @@ class Server:
sys.exit(1)
self.start(port)
logger.info(f'Server Version: {settings.SERVER_VERSIONS[-1]}')
logger.info(f'Python SDK Version: {milvus.__version__}')
logger.info('Listening on port {}'.format(port))
try: