Refactor GPU environment verification and SSH execution for improved flexibility
- Removed the direct injection of environment variables into the script, preventing issues with `from __future__` imports. - Updated the `run_python` function to accept an `env` parameter for passing runtime environment variables, enhancing script execution control. - Adjusted tests to verify the new behavior, ensuring that environment variables are correctly set without modifying the script content.
This commit is contained in:
@@ -323,7 +323,6 @@ def verify_gpu_env(
|
||||
encoding="utf-8"
|
||||
)
|
||||
swarm_flag = "1" if want_swarm else "0"
|
||||
prefix = f"import os\nos.environ['GPU_RENT_CHECK_SWARM']={swarm_flag!r}\n"
|
||||
log(
|
||||
"проверка GPU-стека: nvidia-smi, CUDA"
|
||||
+ (", torch в Comfy venv" if want_swarm else " (llm-only — без torch)")
|
||||
@@ -337,10 +336,11 @@ def verify_gpu_env(
|
||||
out = run_python(
|
||||
cfg,
|
||||
host,
|
||||
prefix + script,
|
||||
script,
|
||||
remote_path="/tmp/gpu-rent-stack_env_probe.py",
|
||||
timeout=180,
|
||||
log=None,
|
||||
env={"GPU_RENT_CHECK_SWARM": swarm_flag},
|
||||
)
|
||||
except Exception as exc:
|
||||
last = [ServiceCheck("gpu-env", False, str(exc)[:200], "vm")]
|
||||
|
||||
Reference in New Issue
Block a user