async def cpnode_list_search(ns={}): center_id = ns['center_id'] if ns.get('center_id') else '' cluster_id = ns['cluster_id'] if ns.get('cluster_id') else '' name = ns['name'] if ns.get('name') else '' db = DBPools() if not cluster_id: return { 'status': False, 'msg': '请传递所属集群id: cluster_id' } async with db.sqlorContext('kboss') as sor: try: if cluster_id and name: search_sql = """ SELECT * from cpnode_list WHERE cluster_id = '%s' and name = '%s' and del_flg = '0'; """ % (cluster_id, name) res = await sor.sqlExe(search_sql, {}) else: search_sql = """ SELECT * from cpnode_list WHERE cluster_id = '%s' and del_flg = '0'; """ % cluster_id res = await sor.sqlExe(search_sql, {}) return { 'status': True, 'msg': '算力节点查找成功', 'data': res } except Exception as e: return { 'status': False, 'msg': '算力节点查找错误, %s' % str(e) } ret = await cpnode_list_search(params_kw) return ret