Refactor backend status handling and improve idle management

- Updated the idle-killer logic to treat SwarmUI `empty` and `disabled` states as busy, preventing unnecessary idle time during provisioning.
- Enhanced the `wait_backend_idle` function to recognize suspended backends as ready, improving resource utilization and user feedback.
- Refined the `install_swarm_comfy` script to skip installation when backends are already present, streamlining the setup process.
- Improved the `resolve_llm_runtime` function to prioritize live configuration over stale state notes, ensuring accurate runtime detection.
- Added tests to validate the new backend status handling and idle management logic, ensuring robustness and reliability.
This commit is contained in:
Leonid Pershin
2026-08-21 10:07:16 +03:00
parent 26f3be6e96
commit 1785ab369c
13 changed files with 302 additions and 90 deletions
+2 -11
View File
@@ -25,17 +25,8 @@ class AccessLink:
def resolve_llm_runtime(cfg: Config) -> str:
"""Live config wins; notes only if cfg is none (legacy session hint)."""
runtime = normalize_runtime(cfg.llm_runtime)
if runtime != "none":
return runtime
try:
noted = (load_state().notes or {}).get("llm_runtime")
if noted:
return normalize_runtime(str(noted))
except Exception:
pass
return "none"
"""Same source as tunnel_forwards: live cfg only (not stale state notes)."""
return normalize_runtime(getattr(cfg, "llm_runtime", "none"))
def collect_access_links(cfg: Config, *, tunneled: bool) -> list[AccessLink]: