[skip ci]Implement get nodes info from milvus metrics (#8351)

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
This commit is contained in:
yanliang567 2021-09-23 13:41:54 +08:00 committed by GitHub
parent 6031075006
commit cc733da43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ class MilvusSys:
def simd_type(self): def simd_type(self):
raise NotImplementedError() raise NotImplementedError()
# TODO: get simd_type when milvus metrics implemented # TODO: get simd_type when milvus metrics implemented
# """get the first query node's simd type"""
# for node in self.nodes: # for node in self.nodes:
# if 'QueryNode' == node.get('infos').get('type'): # if 'QueryNode' == node.get('infos').get('type'):
# return node.get('infos').get('simd_type') # return node.get('infos').get('simd_type')
@ -44,17 +45,28 @@ class MilvusSys:
@property @property
def query_nodes(self): def query_nodes(self):
raise NotImplementedError() query_nodes = []
for node in self.nodes:
if 'QueryNode' == node.get('infos').get('type'):
query_nodes.append(node)
return query_nodes
@property @property
def data_nodes(self): def data_nodes(self):
raise NotImplementedError() data_nodes = []
for node in self.nodes:
if 'DataNode' == node.get('infos').get('type'):
data_nodes.append(node)
return data_nodes
@property @property
def index_nodes(self): def index_nodes(self):
raise NotImplementedError() index_nodes = []
for node in self.nodes:
if 'IndexNode' == node.get('infos').get('type'):
index_nodes.append(node)
return index_nodes
@property @property
def nodes(self): def nodes(self):
return json.loads(self.sys_info.response).get('nodes_info') return json.loads(self.sys_info.response).get('nodes_info')