fix(node): create adapter runtimes with explicit Python
This commit is contained in:
parent
bf2bf48ad0
commit
f0afc9e0ca
|
|
@ -20,6 +20,8 @@
|
|||
---
|
||||
## 已完成关键能力
|
||||
|
||||
- **08-18 / Unreleased / Windows Node 多 runtime 安装修复**:修复统一 BAT 安装器在连续处理 Origin 与 ANSYS 时依赖跨子程序 `PYTHON_EXE/PYTHON_ARGS` 状态、第二个 venv 可能执行成空命令的问题;每个缺失 runtime 现在都直接用已验证的显式 Python 3.12 命令创建,不再共享可变命令状态。
|
||||
|
||||
- **08-18 / Unreleased / ANSYS Mechanical 2024 R2 Node 第一阶段**:新增非默认注册的 `ansys.mechanical.static_structural@v1`,以单几何、显式单位、Structural Steel、Named Selection 支撑/力/压力和受控结果建立声明式静力契约,固定 Worker 已完成 v242/PyMechanical probe、二次语义校验及真机验收门,尚未开放真实求解。Windows Node 打包改为自动收集多个 adapter 和共享契约,manifest 可声明每软件 1–1440 分钟超时且兼容旧版 30 分钟默认值,统一安装器为 Origin/ANSYS 创建隔离 Python 3.12 runtime;68 项专项 unittest、Ruff 致命规则与 .NET build 通过,全量 659 项仅 3 个既有数据库集成模块因测试库缺少 `users` 表未通过(另跳过 4 项),未连接 ANSYS 或数据库。
|
||||
|
||||
- **08-17 / Unreleased / Software Job 单一完成通知与 Origin PNG/3D 修复**:提交/修订工具把成功排队定义为当前 Agent run 的终点,并在返回值中声明后续由系统自动发布,避免 Agent `sleep`、查询、发布后再收到固定完成消息;Origin adapter 0.9.4 不再使用会绘制文字基线的原生 PNG 路径,改为清理 PDF 基线后按请求 DPI 栅格化,同时在添加图形对象前应用最终画布并把模板图层换算为页相对尺寸,修复 3D 曲面图缩小画布后的越界裁切。专项测试、Python 编译与 diff 检查通过,生产数据库仅做只读任务核查。
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class WindowsNodeSourceTests(unittest.TestCase):
|
|||
script = (ROOT / "install-windows-node.bat").read_text(encoding="utf-8")
|
||||
self.assertIn(":detect_origin", script)
|
||||
self.assertIn('reg.exe query "HKCR\\Origin.ApplicationSI\\CLSID"', script)
|
||||
self.assertIn(":find_python", script)
|
||||
self.assertIn(":create_python_runtime", script)
|
||||
self.assertIn("py.exe -3.12", script)
|
||||
self.assertIn("sys.version_info[:2] == (3, 12)", script)
|
||||
self.assertIn(
|
||||
|
|
@ -135,8 +135,15 @@ class WindowsNodeSourceTests(unittest.TestCase):
|
|||
)
|
||||
self.assertIn(":detect_ansys_242", script)
|
||||
self.assertIn("v242\\aisol\\bin\\winx64\\AnsysWBU.exe", script)
|
||||
self.assertIn('call :run_python -m venv "%ORIGIN_RUNTIME_DIR%"', script)
|
||||
self.assertIn('call :run_python -m venv "%ANSYS_RUNTIME_DIR%"', script)
|
||||
self.assertIn(
|
||||
'call :create_python_runtime "%ORIGIN_RUNTIME_DIR%" "%~1"', script
|
||||
)
|
||||
self.assertIn(
|
||||
'call :create_python_runtime "%ANSYS_RUNTIME_DIR%" "%~1"', script
|
||||
)
|
||||
self.assertIn('py.exe -3.12 -m venv "%~1"', script)
|
||||
self.assertIn('python.exe -m venv "%~1"', script)
|
||||
self.assertNotIn('"%PYTHON_EXE%"', script)
|
||||
|
||||
def test_publish_output_contains_the_complete_installer_payload(self) -> None:
|
||||
project = (PROJECT / "Zcbot.WindowsNode.csproj").read_text(encoding="utf-8")
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ set "ORIGIN_RUNTIME_PYTHON=%ORIGIN_RUNTIME_DIR%\Scripts\python.exe"
|
|||
set "ANSYS_REQUIREMENTS=%~dp0adapters\ansys.mechanical.static_structural@v1\requirements.txt"
|
||||
set "ANSYS_RUNTIME_DIR=%ProgramData%\Zcbot\WindowsNode\runtimes\ansys"
|
||||
set "ANSYS_RUNTIME_PYTHON=%ANSYS_RUNTIME_DIR%\Scripts\python.exe"
|
||||
set "PYTHON_EXE="
|
||||
set "PYTHON_ARGS="
|
||||
|
||||
echo [INFO] Installing zcbot Windows Node...
|
||||
|
||||
|
|
@ -31,12 +29,9 @@ if not exist "%ORIGIN_REQUIREMENTS%" (
|
|||
goto :failed
|
||||
)
|
||||
|
||||
call :find_python "%~1"
|
||||
if errorlevel 1 goto :failed
|
||||
|
||||
if not exist "%ORIGIN_RUNTIME_PYTHON%" (
|
||||
echo [INFO] Creating Origin Python runtime...
|
||||
call :run_python -m venv "%ORIGIN_RUNTIME_DIR%"
|
||||
call :create_python_runtime "%ORIGIN_RUNTIME_DIR%" "%~1"
|
||||
if errorlevel 1 (
|
||||
echo [ERR] Failed to create the Origin Python runtime.
|
||||
goto :failed
|
||||
|
|
@ -78,11 +73,9 @@ if not exist "%ANSYS_REQUIREMENTS%" (
|
|||
echo [ERR] ANSYS worker requirements are missing: %ANSYS_REQUIREMENTS%
|
||||
goto :failed
|
||||
)
|
||||
call :find_python "%~1"
|
||||
if errorlevel 1 goto :failed
|
||||
if not exist "%ANSYS_RUNTIME_PYTHON%" (
|
||||
echo [INFO] Creating ANSYS Python runtime...
|
||||
call :run_python -m venv "%ANSYS_RUNTIME_DIR%"
|
||||
call :create_python_runtime "%ANSYS_RUNTIME_DIR%" "%~1"
|
||||
if errorlevel 1 (
|
||||
echo [ERR] Failed to create the ANSYS Python runtime.
|
||||
goto :failed
|
||||
|
|
@ -138,31 +131,29 @@ if defined AWP_ROOT242 if exist "%AWP_ROOT242%\aisol\bin\winx64\AnsysWBU.exe" ex
|
|||
if exist "C:\Program Files\ANSYS Inc\v242\aisol\bin\winx64\AnsysWBU.exe" exit /b 0
|
||||
exit /b 1
|
||||
|
||||
:find_python
|
||||
if not "%~1"=="" (
|
||||
if not exist "%~1" (
|
||||
echo [ERR] Python executable was not found: %~1
|
||||
:create_python_runtime
|
||||
if not "%~2"=="" (
|
||||
if not exist "%~2" (
|
||||
echo [ERR] Python executable was not found: %~2
|
||||
exit /b 1
|
||||
)
|
||||
"%~1" -c "import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)"
|
||||
"%~2" -c "import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)"
|
||||
if errorlevel 1 (
|
||||
echo [ERR] The specified Python must be Python 3.12: %~1
|
||||
echo [ERR] The specified Python must be Python 3.12: %~2
|
||||
exit /b 1
|
||||
)
|
||||
set "PYTHON_EXE=%~1"
|
||||
set "PYTHON_ARGS="
|
||||
echo [INFO] Using Python 3.12: %~1
|
||||
exit /b 0
|
||||
echo [INFO] Using Python 3.12: %~2
|
||||
"%~2" -m venv "%~1"
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
|
||||
where.exe py.exe >nul 2>&1
|
||||
if not errorlevel 1 (
|
||||
py.exe -3.12 -c "import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)" >nul 2>&1
|
||||
if not errorlevel 1 (
|
||||
set "PYTHON_EXE=py.exe"
|
||||
set "PYTHON_ARGS=-3.12"
|
||||
echo [INFO] Using Python 3.12 through py.exe.
|
||||
exit /b 0
|
||||
py.exe -3.12 -m venv "%~1"
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -170,10 +161,9 @@ where.exe python.exe >nul 2>&1
|
|||
if not errorlevel 1 (
|
||||
python.exe -c "import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)" >nul 2>&1
|
||||
if not errorlevel 1 (
|
||||
set "PYTHON_EXE=python.exe"
|
||||
set "PYTHON_ARGS="
|
||||
echo [INFO] Using Python 3.12 from PATH.
|
||||
exit /b 0
|
||||
python.exe -m venv "%~1"
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -181,14 +171,6 @@ echo [ERR] Python 3.12 was not found.
|
|||
echo [INFO] Add Python 3.12 to PATH or run: install-windows-node.bat "C:\path\python.exe"
|
||||
exit /b 1
|
||||
|
||||
:run_python
|
||||
if defined PYTHON_ARGS (
|
||||
"%PYTHON_EXE%" %PYTHON_ARGS% %*
|
||||
) else (
|
||||
"%PYTHON_EXE%" %*
|
||||
)
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:failed
|
||||
echo.
|
||||
echo [ERR] Installation failed.
|
||||
|
|
|
|||
Loading…
Reference in New Issue