From 48aeb4873cabf89275efda673b3493fd85687f29 Mon Sep 17 00:00:00 2001 From: jenkins Date: Tue, 11 Aug 2026 05:38:26 -0300 Subject: [PATCH] hermes: stabilize local GPU workloads --- dockerfiles/hermes-local-image-server.py | 4 +++- services/ai-llm/deployment.yaml | 2 +- services/hermes/local-image-deployment.yaml | 4 +++- testing/tests/test_hermes_chat_quality.py | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dockerfiles/hermes-local-image-server.py b/dockerfiles/hermes-local-image-server.py index a69c7cbfd..b0c65a1ef 100644 --- a/dockerfiles/hermes-local-image-server.py +++ b/dockerfiles/hermes-local-image-server.py @@ -19,7 +19,9 @@ from urllib.request import Request, urlopen HOST = os.environ.get("HERMES_LOCAL_IMAGE_HOST", "0.0.0.0") -PORT = int(os.environ.get("HERMES_LOCAL_IMAGE_PORT", "9004")) +# Kubernetes reserves _PORT for service-link discovery. Keep the +# listener setting out of that namespace so it is always numeric. +PORT = int(os.environ.get("HERMES_LOCAL_IMAGE_LISTEN_PORT", "9004")) MODEL_ID = os.environ.get( "HERMES_LOCAL_IMAGE_MODEL", "black-forest-labs/FLUX.2-klein-4B" ) diff --git a/services/ai-llm/deployment.yaml b/services/ai-llm/deployment.yaml index bfcdc033f..443828037 100644 --- a/services/ai-llm/deployment.yaml +++ b/services/ai-llm/deployment.yaml @@ -129,7 +129,7 @@ spec: pid="$!" trap 'kill -TERM "$pid"; wait "$pid"' TERM INT sleep 6 - if ! timeout 180s ollama run "${OLLAMA_FAST_MODEL}" --keepalive=-1 "reply with just pong" >/tmp/ollama-fast-warm.log 2>&1; then + if ! timeout 180s ollama run "${OLLAMA_FAST_MODEL}" "reply with just pong" >/tmp/ollama-fast-warm.log 2>&1; then cat /tmp/ollama-fast-warm.log >&2 exit 1 fi diff --git a/services/hermes/local-image-deployment.yaml b/services/hermes/local-image-deployment.yaml index a1d1f2c94..a82d6bdeb 100644 --- a/services/hermes/local-image-deployment.yaml +++ b/services/hermes/local-image-deployment.yaml @@ -43,7 +43,7 @@ spec: sizeLimit: 2Gi containers: - name: local-image - image: registry.bstein.dev/bstein/hermes-local-image@sha256:2bf0e5b19ef80cf0cfe7b3d9a4b672df101a3215634a6cede85ff850ada7a28a + image: registry.bstein.dev/bstein/hermes-local-image@sha256:316d123cc48509a53fb32c26bfb384a3ed4d934cb334d73faa0840a62e047e65 imagePullPolicy: IfNotPresent ports: - name: local-image @@ -53,6 +53,8 @@ spec: value: black-forest-labs/FLUX.2-klein-4B - name: HERMES_LOCAL_IMAGE_REVISION value: e7b7dc27f91deacad38e78976d1f2b499d76a294 + - name: HERMES_LOCAL_IMAGE_LISTEN_PORT + value: "9004" - name: LEASE_NAMESPACE value: hermes - name: LEASE_NAME diff --git a/testing/tests/test_hermes_chat_quality.py b/testing/tests/test_hermes_chat_quality.py index 4f9b4f2ee..171efc878 100644 --- a/testing/tests/test_hermes_chat_quality.py +++ b/testing/tests/test_hermes_chat_quality.py @@ -604,6 +604,7 @@ def test_local_flux_runtime_and_gpu_handoff_are_flux_managed(): assert local["ports"] == [{"name": "local-image", "containerPort": 9004}] assert any(mount["mountPath"] == "/models" for mount in local["volumeMounts"]) model_env = {item["name"]: item["value"] for item in local["env"]} + assert model_env["HERMES_LOCAL_IMAGE_LISTEN_PORT"] == "9004" assert model_env["HERMES_LOCAL_IMAGE_REVISION"] == ( "e7b7dc27f91deacad38e78976d1f2b499d76a294" ) @@ -663,6 +664,8 @@ def test_titan20_serializes_classifier_and_local_chat_model_residency(): assert env["OLLAMA_NUM_PARALLEL"] == "1" assert env["OLLAMA_KEEP_ALIVE"] == "-1" assert env["OLLAMA_CONTEXT_LENGTH"] == "8192" + warm_command = " ".join(container["command"]) + assert "--keepalive=-1" not in warm_command models = next(item for item in pod["volumes"] if item["name"] == "models") assert models["persistentVolumeClaim"]["claimName"] == ( "ollama-models-titan20"