Enhance backend recovery and diagnostics in installation and tuning scripts

- Improved the `install_swarm_comfy` function to handle empty backend states more effectively, introducing recovery mechanisms and enhanced logging for better visibility.
- Updated the `tune_swarm_perf` function to always sanitize backend FDS corruption, ensuring consistent performance tuning.
- Added new tests to validate the functionality of backend recovery and FDS sanitization, ensuring robustness in backend management.
This commit is contained in:
Leonid Pershin
2026-08-21 10:54:02 +03:00
parent ef743a6e6d
commit f8bbde8ac0
4 changed files with 40 additions and 13 deletions
+14 -4
View File
@@ -657,11 +657,21 @@ def main() -> int:
return 0
if comfy_venv_ok() and bstat == "empty":
if installed is not True:
print("venv есть, IsInstalled=false — запускаю InstallConfirmWS")
print(
"backend empty при venv/IsInstalled — recover (sanitize FDS / AddNewBackend)…",
flush=True,
)
bstat = recover_empty_backends()
if bstat not in ("empty", "unknown") and not bstat.startswith("error:"):
print(f"recovered empty → {bstat}")
return 0
if installed is True:
print(
"WARN: всё ещё empty после recover — пробую InstallConfirmWS",
flush=True,
)
else:
run_diagnostics()
return 1
print("venv есть, IsInstalled=false — запускаю InstallConfirmWS")
marker = DATA / ".gpu-rent-comfy-installing"
try:
+5 -1
View File
@@ -206,17 +206,21 @@ def main() -> int:
except json.JSONDecodeError:
prev = {}
same_gpu = bool(prev.get("uuid") and prev.get("uuid") == plan["uuid"])
# Always repair FDS corruption even when tune is otherwise a no-op.
fds_fixed = sanitize_backends_fds()
if same_gpu and prev.get("extra_args") == plan["extra_args"]:
if prev.get("pip_ok") or not plan["use_sage"]:
print(f"perf tune already applied for {plan['name']} ({plan['tier']})")
if fds_fixed:
print("RESTART_SWARMUI=1")
return 0
if same_gpu and plan["use_sage"] and prev.get("pip_ok") is False:
print("perf tune: retry (previous pip_ok=false — sage/triton ещё не встали)")
print(f"perf tune: {plan['name']} tier={plan['tier']} sage={plan['use_sage']}")
restarted_needed = bool(fds_fixed)
pip_ok = not plan["use_sage"]
restarted_needed = False
if plan["use_sage"]:
py = find_comfy_python()
if py: