From f9ea2be3d5ad634ba19e4a6f8e0f5b30e3ac7020 Mon Sep 17 00:00:00 2001 From: jenkins Date: Mon, 29 Jun 2026 15:33:50 -0300 Subject: [PATCH] fix(ai): prewarm quick chat model --- services/ai-llm/deployment.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/services/ai-llm/deployment.yaml b/services/ai-llm/deployment.yaml index c3f96edbf..d7a3d2c51 100644 --- a/services/ai-llm/deployment.yaml +++ b/services/ai-llm/deployment.yaml @@ -88,6 +88,8 @@ spec: env: - name: OLLAMA_HOST value: 0.0.0.0 + - name: OLLAMA_FAST_MODEL + value: qwen2.5-coder:1.5b-instruct-q4_0 - name: OLLAMA_KEEP_ALIVE value: 6h - name: OLLAMA_MODELS @@ -96,13 +98,27 @@ spec: value: all - name: NVIDIA_DRIVER_CAPABILITIES value: compute,utility + command: + - /bin/sh + - -c + - | + set -e + ollama serve & + pid="$!" + trap 'kill -TERM "$pid"; wait "$pid"' TERM INT + sleep 6 + timeout 180s ollama run "${OLLAMA_FAST_MODEL}" "reply with just pong" >/tmp/ollama-fast-warm.log 2>&1 + touch /tmp/ollama-fast-ready + wait "$pid" volumeMounts: - name: models mountPath: /root/.ollama readinessProbe: - httpGet: - path: /api/tags - port: 11434 + exec: + command: + - /bin/sh + - -c + - test -f /tmp/ollama-fast-ready && ollama list >/dev/null 2>&1 initialDelaySeconds: 15 periodSeconds: 10 timeoutSeconds: 5