async parallel node dependency installation with after_install hook

This commit is contained in:
jingrow 2025-11-14 02:32:49 +08:00
parent deb2b3295c
commit 91818f1786

View File

@ -148,13 +148,12 @@ def _format_install_result(node_type: str, success: bool, stdout: str, stderr: s
} }
def install_node_dependencies(node_type: str, sync: bool = True) -> Dict[str, Any]: def install_node_dependencies(node_type: str) -> Dict[str, Any]:
""" """
安装节点的依赖 安装节点的依赖同步版本用于单个节点安装
Args: Args:
node_type: 节点类型 node_type: 节点类型
sync: 是否同步安装当前未使用保留以兼容未来扩展
Returns: Returns:
安装结果字典 安装结果字典
@ -576,7 +575,6 @@ def install_all_nodes_dependencies(max_concurrent: int = 5) -> List[Dict[str, An
return await asyncio.gather(*tasks, return_exceptions=True) return await asyncio.gather(*tasks, return_exceptions=True)
# 运行异步函数 # 运行异步函数
try:
results = asyncio.run(install_all()) results = asyncio.run(install_all())
# 处理异常结果 # 处理异常结果
@ -598,9 +596,4 @@ def install_all_nodes_dependencies(max_concurrent: int = 5) -> List[Dict[str, An
logger.info(f"节点依赖安装完成: {success_count}/{len(nodes)} 成功") logger.info(f"节点依赖安装完成: {success_count}/{len(nodes)} 成功")
return processed_results return processed_results
except Exception as e:
logger.error(f"并行安装节点依赖时发生异常: {str(e)}")
# 如果异步安装失败,回退到同步安装
logger.warning("回退到同步安装模式")
return [install_node_dependencies(node) for node in nodes]