Enhance SwarmUI integration and GPU environment verification
- Updated CLI documentation to reflect the new handling of `CIVITAI_API_TOKEN`, which is now automatically passed to SwarmUI user settings during startup. - Improved the `render_access_panel` function to include additional warnings for idle-killer failures and stack errors, enhancing user feedback. - Introduced a new function `seed_swarmui_api_keys` to manage API key injection into SwarmUI, ensuring seamless integration with the Model Downloader. - Enhanced GPU environment verification logic to include fail-fast checks for critical components like CUDA, improving error handling and user notifications. - Updated tests to validate the new API key handling and access panel behavior, ensuring robustness in the integration process.
This commit is contained in:
@@ -95,6 +95,35 @@ def test_verify_gpu_env_ok(monkeypatch):
|
||||
assert any("GPU-стека" in line for line in logs)
|
||||
|
||||
|
||||
def test_verify_gpu_env_fail_fast_cuda(monkeypatch):
|
||||
import json
|
||||
|
||||
import gpu_rent.ssh_ops as ssh_ops
|
||||
|
||||
payload = {
|
||||
"ok": False,
|
||||
"checks": [
|
||||
{"name": "nvidia-smi", "required": True, "ok": True, "detail": "ok"},
|
||||
{"name": "cuda", "required": True, "ok": False, "detail": "нет libcuda"},
|
||||
{"name": "torch", "required": True, "ok": False, "detail": "no venv"},
|
||||
],
|
||||
}
|
||||
calls = {"n": 0}
|
||||
|
||||
def fake(*a, **k):
|
||||
calls["n"] += 1
|
||||
return json.dumps(payload)
|
||||
|
||||
monkeypatch.setattr(ssh_ops, "run_python", fake)
|
||||
logs: list[str] = []
|
||||
try:
|
||||
verify_gpu_env(_Cfg(), "1.2.3.4", logs.append, timeout=600.0, poll_every=0.1)
|
||||
assert False, "expected CloudError"
|
||||
except CloudError as exc:
|
||||
assert "fail-fast" in str(exc).lower() or "cuda" in str(exc).lower()
|
||||
assert calls["n"] == 1
|
||||
|
||||
|
||||
def test_verify_gpu_env_fails_without_cuda(monkeypatch):
|
||||
import json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user