diff --git a/shards/mishards/exception_handlers.py b/shards/mishards/exception_handlers.py index 77cc99f22d..bee6200f49 100644 --- a/shards/mishards/exception_handlers.py +++ b/shards/mishards/exception_handlers.py @@ -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) diff --git a/shards/mishards/router/__init__.py b/shards/mishards/router/__init__.py index 4c0fc815da..033aa3f5b1 100644 --- a/shards/mishards/router/__init__.py +++ b/shards/mishards/router/__init__.py @@ -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 diff --git a/shards/mishards/server.py b/shards/mishards/server.py index 741d5582e4..10ed886329 100644 --- a/shards/mishards/server.py +++ b/shards/mishards/server.py @@ -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: