Files
Kaname/src/worker/log-causes.ts
T
Pascal LinxweilerandClaude Opus 5.5 66e6a8c4f7 Deployments: llama.cpp web UI toggle, clearer start failures, log fixes
- Web UI option for llama.cpp deployments (--no-webui when off); the deployment
  page links to it on the published host port.
- Follow container logs after the start with tail=all: following a created
  container returned an already-closed stream, so startup output was lost.
- Failed starts name the cause from the log (vLLM ValueError, llama.cpp error
  lines) before the last output.
- A deployment's vLLM dtype replaces the runtime's --dtype instead of repeating it.
- vLLM memory estimate: 3 GiB overhead (measured ~6.9 GiB for SmolLM2-135M
  with a 4 GiB KV cache).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 12:01:52 +02:00

21 lines
1.0 KiB
TypeScript

// Picks the likely cause of a failed start out of a container log. Pure, for tests.
// "(Worker pid=171) ERROR 10-06 09:50:06 [multiproc_executor.py:1058] " and similar vLLM prefixes.
const VLLM_PREFIX = /^\([\w ]+pid=\d+\)\s+(?:[A-Z]+\s+\d\d-\d\d \d\d:\d\d:\d\d\s+\[[^\]]*\]\s*)?/;
// A Python exception line ("ValueError: …"), llama.cpp's "error:"/"failed to" lines.
const CAUSE = /^(?:[\w.]*(?:Error|Exception): \S|.*\berror: \S|.*\bfailed to (?:load|open|allocate)\b)/i;
// Generic wrappers that only say "see above".
const WRAPPER = /Engine core initialization failed|See root cause above|exiting due to/i;
/** Distinct cause lines in order of first appearance (at most `max`). */
export function errorCauses(lines: string[], max = 3): string[] {
const out: string[] = [];
for (const raw of lines) {
const line = raw.replace(VLLM_PREFIX, "").trim();
if (!CAUSE.test(line) || WRAPPER.test(line) || out.includes(line)) continue;
out.push(line.length > 500 ? `${line.slice(0, 500)}…` : line);
if (out.length >= max) break;
}
return out;
}