31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
async def cpnode_config_search(ns={}):
|
|
node_id = ns['node_id'] if ns.get('node_id') else ''
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
if node_id:
|
|
search_sql = """ SELECT * from cpnode_config WHERE node_id = '%s' and del_flg = '0'; """ % node_id
|
|
res = await sor.sqlExe(search_sql, {})
|
|
else:
|
|
search_sql = """ SELECT * from cpnode_config WHERE del_flg = '0'; """
|
|
res = await sor.sqlExe(search_sql, {})
|
|
|
|
if res:
|
|
for i in res:
|
|
if i.get('component_id'):
|
|
i['component_id'] = json.loads(i['component_id'].replace("'", '"')) if isinstance(i['component_id'], str) else i['component_id']
|
|
|
|
return {
|
|
'status': True,
|
|
'msg': '算力节点配置信息查找成功',
|
|
'data': res
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
'status': False,
|
|
'msg': '算力节点配置信息查找错误, %s' % str(e)
|
|
}
|
|
|
|
ret = await cpnode_config_search(params_kw)
|
|
return ret
|
|
|