From d950fc8e64ee508334e608f6045d687d73a464be Mon Sep 17 00:00:00 2001 From: historia Date: Mon, 24 Aug 2026 17:37:34 -0400 Subject: feat: tui backend server progress and generate script progress --- app/backends/probe.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/backends/probe.py') diff --git a/app/backends/probe.py b/app/backends/probe.py index ebef86e..efa2963 100644 --- a/app/backends/probe.py +++ b/app/backends/probe.py @@ -126,3 +126,26 @@ def same_endpoint(url_a: str, url_b: str) -> bool: port_a = a.port or (443 if (a.scheme or "http") == "https" else 80) port_b = b.port or (443 if (b.scheme or "http") == "https" else 80) return host_a == host_b and port_a == port_b + + +def health_payload(url: str, timeout: float = DEFAULT_TIMEOUT) -> Optional[dict]: + """Return the server's ``/health`` JSON document, or None. + + A cheaper, raw check than ``identify_server``: used by the run view's + background poll to tell "process alive" from "server answering" without + probing every identity endpoint. + """ + if not url: + return None + return _get_json(f"{url.rstrip('/')}/health", timeout) + + +def faster_model_loaded(url: str, timeout: float = DEFAULT_TIMEOUT) -> bool: + """True when a faster server at URL reports its model loaded. + + faster's ``/health`` answers with a ``model_loaded`` flag only after the + weights are resident, so this is the "truly ready" signal used while + waiting for a started server to become usable. + """ + payload = health_payload(url, timeout) + return bool(payload and payload.get("model_loaded")) -- cgit v1.2.3