1889ab45fb
Hotfix (was v0.3.1):
- services.py: cache 'unreachable' per (host,user) for 25s so a dead Spark doesn't hang every /api/services call behind 6s ssh timeout
- ssh_run timeout reduced 10 -> 6s for docker_state probes
- hardware probe: shorter SSH timeout (6s), longer cache TTL for failures (25s)
- JS pollStatus retries loadModels() if state.models is empty (recovers from cold-start proxy timeout)
- Unreachable hardware card now includes troubleshooting steps (Spark Control cannot SSH into an unreachable Spark to restart it)
v0.4 NIM installer:
- nim.py module: curated SUGGESTED_NIMS list (Parakeet, Magpie, Riva) + NimManager that runs docker login nvcr.io + docker pull + docker run -d --gpus all -p PORT:PORT -v VOL:/opt/nim/.cache -e NGC_API_KEY -e ... --restart=unless-stopped + chown the volume to uid 1000 + restart. Streams all output via SSE; redacts the API key from log lines.
- custom_services.py: persists installed NIMs to /data/services-overrides.yaml so they appear in the services panel after install
- services.py: merges custom services into the panel
- /api/nim/catalog GET, /api/nim/install POST + GET/SSE
- /api/services/{name} DELETE for custom services
- UI: '+ Install NIM' button next to 'Always-on services'; modal lists curated images each with a 'Pick' button + a custom-image form; installation runs in a second dialog with phase + elapsed timer + collapsible log
- NGC API key field added to Configure Sparks (masked); injected as NGC_API_KEY env var into the container
Package: bump 0.4.0:0; main.ts adds SERVICES_OVERRIDES + NGC_API_KEY env vars
78 lines
2.5 KiB
Python
78 lines
2.5 KiB
Python
from __future__ import annotations
|
|
import os
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
|
|
def _env(name: str, default: str = "") -> str:
|
|
return os.environ.get(name, default)
|
|
|
|
|
|
def _resolve_models_yaml() -> str:
|
|
if env := os.environ.get("MODELS_YAML"):
|
|
return env
|
|
here = Path(__file__).resolve().parent # app/
|
|
candidates = [
|
|
here.parent / "models.yaml", # image/models.yaml (Docker)
|
|
here.parent.parent / "models.yaml", # <repo>/models.yaml (dev)
|
|
Path("/app/models.yaml"), # explicit container path
|
|
]
|
|
for p in candidates:
|
|
if p.exists():
|
|
return str(p)
|
|
return str(candidates[0]) # let load fail with a clear path
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
spark1_host: str
|
|
spark1_user: str
|
|
spark2_host: str
|
|
spark2_user: str
|
|
parakeet_host: str
|
|
parakeet_user: str
|
|
parakeet_container: str
|
|
magpie_host: str
|
|
magpie_user: str
|
|
magpie_container: str
|
|
ssh_key_path: str
|
|
ssh_known_hosts: str
|
|
models_yaml: str
|
|
vllm_port: int
|
|
parakeet_port: int
|
|
magpie_port: int
|
|
bind_port: int
|
|
open_webui_url: str
|
|
ngc_api_key: str
|
|
|
|
@classmethod
|
|
def from_env(cls) -> "Settings":
|
|
spark2_host = _env("SPARK2_HOST")
|
|
spark2_user = _env("SPARK2_USER")
|
|
# Parakeet and Magpie default to Spark 2 unless explicitly overridden.
|
|
return cls(
|
|
spark1_host=_env("SPARK1_HOST"),
|
|
spark1_user=_env("SPARK1_USER"),
|
|
spark2_host=spark2_host,
|
|
spark2_user=spark2_user,
|
|
parakeet_host=_env("PARAKEET_HOST") or spark2_host,
|
|
parakeet_user=_env("PARAKEET_USER") or spark2_user,
|
|
parakeet_container=_env("PARAKEET_CONTAINER") or "parakeet-asr",
|
|
magpie_host=_env("MAGPIE_HOST") or spark2_host,
|
|
magpie_user=_env("MAGPIE_USER") or spark2_user,
|
|
magpie_container=_env("MAGPIE_CONTAINER") or "magpie-tts",
|
|
ssh_key_path=_env("SSH_KEY_PATH"),
|
|
ssh_known_hosts=_env("SSH_KNOWN_HOSTS"),
|
|
models_yaml=_resolve_models_yaml(),
|
|
vllm_port=int(_env("VLLM_PORT", "8888")),
|
|
parakeet_port=int(_env("PARAKEET_PORT", "8000")),
|
|
magpie_port=int(_env("MAGPIE_PORT", "9000")),
|
|
bind_port=int(_env("BIND_PORT", "9999")),
|
|
open_webui_url=_env("OPEN_WEBUI_URL", ""),
|
|
ngc_api_key=_env("NGC_API_KEY", ""),
|
|
)
|
|
|
|
@property
|
|
def configured(self) -> bool:
|
|
return bool(self.spark1_host)
|