Implement headless ComfyUI installation and improve backend status handling

- Added a new function to ensure headless installation of ComfyUI when backends are empty, enhancing the setup process for SwarmUI.
- Updated documentation to clarify the installation flow and backend readiness checks, ensuring users understand the requirements for a successful setup.
- Enhanced backend status checks to differentiate between 'empty' and 'idle' states, improving error handling and user feedback during provisioning.
- Adjusted logging messages to provide clearer insights into the installation and backend status processes.
This commit is contained in:
Leonid Pershin
2026-08-21 09:18:59 +03:00
parent 97abc7985e
commit f7ba915e74
9 changed files with 454 additions and 8 deletions
+21 -3
View File
@@ -56,10 +56,16 @@ while time.time() < deadline:
bstat = str(be.get("status") or "unknown").lower()
if waiting or live or loading:
print(f"BUSY queue w={waiting} live={live} load={loading}")
elif bstat not in ("idle", "disabled", "all_disabled", "empty"):
elif bstat == "empty":
# No backends registered — Comfy never installed (Install wizard).
# Not "Idle": treat as wait, never ready.
print("BUSY backend=empty (нужен first-install Comfy)")
elif bstat in ("disabled", "all_disabled"):
print(f"BUSY backend={bstat}")
else:
elif bstat == "idle":
print(f"READY backend={bstat}")
else:
print(f"BUSY backend={bstat}")
raise SystemExit(0)
except Exception as exc:
print(f"WAIT {exc}")
@@ -316,7 +322,13 @@ def verify_gpu_env(
from gpu_rent.ssh_ops import run_python
# These never "appear later" on a broken image — don't burn the poll budget.
# Empty-backend / missing install also won't self-heal without InstallConfirmWS.
instant_fail_names = {"nvidia-smi", "cuda"}
instant_fail_detail_substrings = (
"dlbackend пуст",
"backend=empty",
"Install не прогоняли",
)
want_swarm = bool(getattr(cfg, "enable_swarmui", True))
script = files("gpu_rent.remote").joinpath("stack_env_probe.py").read_text(
@@ -391,6 +403,11 @@ def verify_gpu_env(
return last
instant = [c for c in hard if c.name in instant_fail_names]
if not instant:
for c in hard:
detail_l = (c.detail or "").lower()
if any(s.lower() in detail_l for s in instant_fail_detail_substrings):
instant.append(c)
if instant:
for c in last:
mark = "ok" if c.ok else "FAIL"
@@ -399,7 +416,8 @@ def verify_gpu_env(
failed = [c.name for c in instant]
raise CloudError(
f"GPU-стек: нет {', '.join(failed)} (fail-fast). "
"Проверь образ Driver / nvidia на VM. "
"Проверь образ Driver / nvidia на VM; для SwarmUI — "
"first-install Comfy (InstallConfirmWS / dlbackend). "
"Дальше: gpu-rent status · gpu-rent logs · gpu-rent stop"
)
return last