Update configuration and documentation for LLM support and local watchdog

- Added `ollama-models.yaml` to .gitignore and implemented logic to copy it in gpu-rent.ps1 and gpu-rent.sh.
- Enhanced env.example to include new variables for LLM runtime options and local watchdog configuration.
- Updated CLI commands to support LLM options during setup and execution, including new flags for Ollama and llama.cpp.
- Improved documentation in cli.md and README.md to reflect changes in LLM integration and local watchdog functionality.
- Adjusted architecture and decisions documentation to clarify the role of LLMs and local watchdog in the system.
This commit is contained in:
Leonid Pershin
2026-08-21 05:29:23 +03:00
parent a9cf2e0f90
commit 2005b00175
43 changed files with 2258 additions and 197 deletions
+27 -5
View File
@@ -84,12 +84,25 @@ def _bind_access(
save_state(state)
wait_ssh(cfg, ip)
log(f"SSH {cfg.ssh_user}@{ip}")
state.phase = "bootstrapping"
save_state(state)
if update:
active = run_ssh(cfg, ip, "systemctl is-active swarmui 2>/dev/null || true", check=False).strip()
if active == "active":
log("systemctl stop swarmui перед git update")
run_ssh(cfg, ip, "sudo -n systemctl stop swarmui", timeout=120, check=False)
run_bootstrap(cfg, ip, log, update=update)
# Skip apt-heavy bootstrap when the VM already finished first-boot.
marker = run_ssh(
cfg,
ip,
"test -f /opt/swarmui/.gpu-rent-bootstrapped && echo yes || echo no",
check=False,
).strip()
if marker == "yes" and state.bootstrapped:
log("bootstrap уже на VM — лёгкий проход (без apt)")
run_bootstrap(cfg, ip, log, update=update, light=True)
else:
run_bootstrap(cfg, ip, log, update=update, light=False)
provision_vm(
cfg,
ip,
@@ -135,6 +148,8 @@ def adopt_server(cfg: Config, log: Log = _log_default, *, update: bool = True) -
save_state(state)
log(f"подхватили {server.id} статус {server_status(server)}")
if server_status(server) == "ACTIVE":
state.phase = "bootstrapping"
save_state(state)
_bind_access(conn, server, state, cfg, log, update=update)
return state
@@ -165,7 +180,7 @@ def cmd_up(
if status == "ACTIVE":
if state.bootstrapped and state.floating_ip:
log("сервер уже ACTIVE — второй GPU не создаём")
state.phase = "ready_cloud"
state.phase = "bootstrapping"
save_state(state)
_bind_access(conn, existing, state, cfg, log, update=do_update)
return state
@@ -187,7 +202,7 @@ def cmd_up(
outcome = probe_ssh(cfg, fip, attempts=2) if fip else "down"
if outcome == "ok":
log("сервер ACTIVE, SSH ок — продолжаем bootstrap")
state.phase = "ready_cloud"
state.phase = "bootstrapping"
save_state(state)
_bind_access(conn, existing, state, cfg, log, update=do_update)
return state
@@ -213,7 +228,7 @@ def cmd_up(
if existing is not None and status in {"EXPIRED", "SHELVED", "SHELVED_OFFLOADED"}:
existing = unshelve(conn, existing, log)
state.server_id = existing.id
state.phase = "ready_cloud"
state.phase = "bootstrapping"
state.unshelved_at = utc_now()
save_state(state)
_bind_access(conn, existing, state, cfg, log, update=do_update)
@@ -341,7 +356,7 @@ def cmd_up(
state.server_name = getattr(server, "name", None)
state.created_at = utc_now()
state.unshelved_at = None
state.phase = "ready_cloud"
state.phase = "bootstrapping"
save_state(state)
_bind_access(conn, server, state, cfg, log, update=do_update)
return state
@@ -396,7 +411,14 @@ def cmd_stop(
state.server_id = None
state.server_name = None
state.bootstrapped = False
state.phase = "idle"
save_state(state)
try:
from gpu_rent.local_watchdog import clear_lease
clear_lease()
except Exception:
pass
log("фаза idle" + ("" if destroy_disks else " (диски на месте)"))
return state