Keep router connected to profile controller

This commit is contained in:
Mikei386
2026-09-15 11:30:57 +02:00
parent 80917e72b4
commit 54d38a31aa
2 changed files with 13 additions and 3 deletions
+4
View File
@@ -530,6 +530,10 @@ services:
ROUTER_STATE_FILE: /var/lib/mike-ai-profile-router/state.json ROUTER_STATE_FILE: /var/lib/mike-ai-profile-router/state.json
ROUTER_MAX_CONCURRENT_REQUESTS: "16" ROUTER_MAX_CONCURRENT_REQUESTS: "16"
UPSTREAM_URL: http://llama-upstream:8080 UPSTREAM_URL: http://llama-upstream:8080
# Profile are switched by the privileged controller. The router itself
# stays unprivileged and never manipulates Docker or host files directly.
PROFILE_CONTROL_URL: http://profile-controller:8090
PROFILE_CONTROL_TOKEN: "${CONTROLLER_TOKEN:?CONTROLLER_TOKEN is required}"
SWITCH_TIMEOUT: "600" SWITCH_TIMEOUT: "600"
REQUEST_TIMEOUT: "600" REQUEST_TIMEOUT: "600"
YUE2_START_TIMEOUT: "600" YUE2_START_TIMEOUT: "600"
+9 -3
View File
@@ -73,7 +73,7 @@ import os
import urllib.request import urllib.request
key = os.environ["ROUTER_API_KEY"] key = os.environ["ROUTER_API_KEY"]
for path in ("/health", "/v1/models"): for path in ("/health", "/v1/models", "/status"):
request = urllib.request.Request( request = urllib.request.Request(
"http://127.0.0.1:8081" + path, "http://127.0.0.1:8081" + path,
headers={"Authorization": "Bearer " + key}, headers={"Authorization": "Bearer " + key},
@@ -82,10 +82,16 @@ for path in ("/health", "/v1/models"):
body = response.read() body = response.read()
if response.status != 200: if response.status != 200:
raise SystemExit(f"{path}: HTTP {response.status}") raise SystemExit(f"{path}: HTTP {response.status}")
if path.endswith("models") and not json.loads(body).get("data"): data = json.loads(body)
if path.endswith("models") and not data.get("data"):
raise SystemExit("Router meldet keine Modelle") raise SystemExit("Router meldet keine Modelle")
if path == "/status":
if data.get("current_profile") not in data.get("profiles", {}):
raise SystemExit("Router erkennt das aktive Profil nicht")
if not data.get("qwen", {}).get("available"):
raise SystemExit("Router meldet Qwen als nicht verfügbar")
PY PY
pass "Router-Liveness und OpenAI-Modellliste funktionieren" pass "Router erkennt aktives Profil; Liveness und Modellliste funktionieren"
latest=/data/docker-backups/athena-latest.tar.gz latest=/data/docker-backups/athena-latest.tar.gz
[[ -s $latest ]] || fail "Kein gueltiges Athena-Backup: $latest" [[ -s $latest ]] || fail "Kein gueltiges Athena-Backup: $latest"