def DescribeTable(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.TableSchema(status=status_pb2.Status( error_code=_status.code, reason=_status.message), ) metadata = {'resp_class': milvus_pb2.TableSchema} logger.info('DescribeTable {}'.format(_table_name)) _status, _table = self._describe_table(metadata=metadata, table_name=_table_name) if _status.OK(): return milvus_pb2.TableSchema( table_name=_table_name, index_file_size=_table.index_file_size, dimension=_table.dimension, metric_type=_table.metric_type, status=status_pb2.Status(error_code=_status.code, reason=_status.message), ) return milvus_pb2.TableSchema( table_name=_table_name, status=status_pb2.Status(error_code=_status.code, reason=_status.message), )
def DescribeIndex(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message)) metadata = {'resp_class': milvus_pb2.IndexParam} logger.info('DescribeIndex {}'.format(_table_name)) _status, _index_param = self._describe_index(table_name=_table_name, metadata=metadata) if not _index_param: return milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message)) _index_type = _index_param._index_type grpc_index = milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message), table_name=_table_name, index_type=_index_type) grpc_index.extra_params.add(key='params', value=ujson.dumps(_index_param._params)) return grpc_index
def ShowTableInfo(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.TableInfo(status=status_pb2.Status( error_code=_status.code, reason=_status.message), ) metadata = {'resp_class': milvus_pb2.TableInfo} logger.info('ShowTableInfo {}'.format(_table_name)) _status, _info = self._table_info(metadata=metadata, table_name=_table_name) if _status.OK(): _table_info = milvus_pb2.TableInfo(status=status_pb2.Status( error_code=_status.code, reason=_status.message), total_row_count=_info.count) for par_stat in _info.partitions_stat: _par = milvus_pb2.PartitionStat(tag=par_stat.tag, total_row_count=par_stat.count) for seg_stat in par_stat.segments_stat: _par.segments_stat.add( segment_name=seg_stat.segment_name, row_count=seg_stat.count, index_name=seg_stat.index_name, data_size=seg_stat.data_size, ) _table_info.partitions_stat.append(_par) return _table_info return milvus_pb2.TableInfo(status=status_pb2.Status( error_code=_status.code, reason=_status.message), )
def DropIndex(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return status_pb2.Status(error_code=_status.code, reason=_status.message) logger.info('DropIndex {}'.format(_table_name)) _status = self._drop_index(_table_name) return status_pb2.Status(error_code=_status.code, reason=_status.message)
def PreloadTable(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return status_pb2.Status(error_code=_status.code, reason=_status.message) logger.info('PreloadTable {}'.format(_table_name)) _status = self._preload_table(_table_name) return status_pb2.Status(error_code=_status.code, reason=_status.message)
def HasTable(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.BoolReply(status=status_pb2.Status( error_code=_status.code, reason=_status.message), bool_reply=False) logger.info('HasTable {}'.format(_table_name)) _status, _bool = self._has_table(_table_name, metadata={'resp_class': milvus_pb2.BoolReply}) return milvus_pb2.BoolReply(status=status_pb2.Status( error_code=_status.code, reason=_status.message), bool_reply=_bool)
def ShowPartitions(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.PartitionList(status=status_pb2.Status( error_code=_status.code, reason=_status.message), partition_array=[]) logger.info('ShowPartitions {}'.format(_table_name)) _status, partition_array = self.router.connection().show_partitions( _table_name) return milvus_pb2.PartitionList( status=status_pb2.Status(error_code=_status.code, reason=_status.message), partition_tag_array=[param.tag for param in partition_array])
def CountTable(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): status = status_pb2.Status(error_code=_status.code, reason=_status.message) return milvus_pb2.TableRowCount(status=status) logger.info('CountTable {}'.format(_table_name)) metadata = {'resp_class': milvus_pb2.TableRowCount} _status, _count = self._count_table(_table_name, metadata=metadata) return milvus_pb2.TableRowCount( status=status_pb2.Status(error_code=_status.code, reason=_status.message), table_row_count=_count if isinstance(_count, int) else -1)
def DescribeIndex(self, request, context): _status, _table_name = Parser.parse_proto_TableName(request) if not _status.OK(): return milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message)) metadata = {'resp_class': milvus_pb2.IndexParam} logger.info('DescribeIndex {}'.format(_table_name)) _status, _index_param = self._describe_index(table_name=_table_name, metadata=metadata) if not _index_param: return milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message)) _index = milvus_pb2.Index(index_type=_index_param._index_type, nlist=_index_param._nlist) return milvus_pb2.IndexParam(status=status_pb2.Status( error_code=_status.code, reason=_status.message), table_name=_table_name, index=_index)