diff --git a/apps/jingrow/jingrow/utils/node_dependencies.py b/apps/jingrow/jingrow/utils/node_dependencies.py index 328cce1..740e3e1 100644 --- a/apps/jingrow/jingrow/utils/node_dependencies.py +++ b/apps/jingrow/jingrow/utils/node_dependencies.py @@ -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: node_type: 节点类型 - sync: 是否同步安装(当前未使用,保留以兼容未来扩展) Returns: 安装结果字典 @@ -576,31 +575,25 @@ def install_all_nodes_dependencies(max_concurrent: int = 5) -> List[Dict[str, An return await asyncio.gather(*tasks, return_exceptions=True) # 运行异步函数 - try: - results = asyncio.run(install_all()) - - # 处理异常结果 - processed_results = [] - for i, result in enumerate(results): - if isinstance(result, Exception): - node_type = nodes[i] - logger.error(f"安装节点 {node_type} 依赖时发生异常: {str(result)}") - processed_results.append({ - "success": False, - "error": f"异常: {str(result)}", - "node_type": node_type - }) - else: - processed_results.append(result) - - # 统计结果 - success_count = sum(1 for r in processed_results if r.get("success")) - logger.info(f"节点依赖安装完成: {success_count}/{len(nodes)} 成功") - - return processed_results - except Exception as e: - logger.error(f"并行安装节点依赖时发生异常: {str(e)}") - # 如果异步安装失败,回退到同步安装 - logger.warning("回退到同步安装模式") - return [install_node_dependencies(node) for node in nodes] + results = asyncio.run(install_all()) + + # 处理异常结果 + processed_results = [] + for i, result in enumerate(results): + if isinstance(result, Exception): + node_type = nodes[i] + logger.error(f"安装节点 {node_type} 依赖时发生异常: {str(result)}") + processed_results.append({ + "success": False, + "error": f"异常: {str(result)}", + "node_type": node_type + }) + else: + processed_results.append(result) + + # 统计结果 + success_count = sum(1 for r in processed_results if r.get("success")) + logger.info(f"节点依赖安装完成: {success_count}/{len(nodes)} 成功") + + return processed_results