From 2bb3cf72170b57de56358ca4ce4893346ebbabf0 Mon Sep 17 00:00:00 2001 From: noonghunna <10742901+noonghunna@users.noreply.github.com> Date: Wed, 6 May 2026 22:24:28 +0000 Subject: [PATCH] power-cap-sweep: make CONTAINER optional for host engine builds (#85, #87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same engine-coupling fix as a8606e3 applied to power-cap-sweep.sh. Previously line 129 hard-required CONTAINER to be non-empty, which blocked host-build llama.cpp users (no docker container) from running the sweep even with explicit URL + MODEL. Now: CONTAINER is optional. URL + MODEL are the only hard requirements. If CONTAINER is unset, defaults to "none" — bench.sh's docker-log scrape gracefully no-ops on that value (already validated in earlier work). Also tightens the error message — explicitly notes "CONTAINER is optional — set CONTAINER=none for host builds" so a host-build user hitting a real misconfig (missing URL or MODEL) sees the right hint. Smoke-tested both branches: 1. CONTAINER=none URL=http://localhost:8030 MODEL=... → runs end-to-end, bench actually executes, real measurement captured at 250W cap. 2. PREFLIGHT_NO_AUTODETECT=1 (no URL/MODEL/CONTAINER) → fails fast with "could not auto-detect a running URL + MODEL" + the optional-CONTAINER hint. Closes the third script in the harness-engine-decoupling triplet (verify-full + soak-test landed in a8606e3; verify-stress.sh remaining, deferred since its docker refs are diagnostic hints not blockers). --- scripts/power-cap-sweep.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/power-cap-sweep.sh b/scripts/power-cap-sweep.sh index 55dedd8b..dfeab402 100755 --- a/scripts/power-cap-sweep.sh +++ b/scripts/power-cap-sweep.sh @@ -107,7 +107,7 @@ if [ ! -x "$BENCH" ]; then echo "[error] expected $BENCH" >&2; exit 1 fi -# Auto-detect URL/CONTAINER/MODEL from the running vllm container. +# Auto-detect URL/CONTAINER/MODEL from the running engine. # This must happen BEFORE we exec bench.sh under our sudo context — bench.sh's # own autodetect doesn't reliably fire when re-invoked under sudo (env vars # get stripped, defaults kick in, wrong MODEL → HTTP 404 against the server). @@ -126,10 +126,19 @@ if [ -z "${MODEL:-}" ] && [ -n "${URL:-}" ]; then | python3 -c "import sys, json; print(json.load(sys.stdin)['data'][0]['id'])" 2>/dev/null || echo "") fi -if [ -z "${URL:-}" ] || [ -z "${MODEL:-}" ] || [ -z "${CONTAINER:-}" ]; then - echo "[error] could not auto-detect a running container + URL + MODEL." >&2 +# CONTAINER is OPTIONAL — host engine builds (e.g. llama.cpp host server, see +# club-3090#85, #87) have no container. URL + MODEL are the only hard +# requirements. If CONTAINER is unset we mark it "none" for display, which is +# also the value bench.sh expects to skip its docker-log scrape cleanly. +if [ -z "${CONTAINER:-}" ]; then + CONTAINER="none" +fi + +if [ -z "${URL:-}" ] || [ -z "${MODEL:-}" ]; then + echo "[error] could not auto-detect a running URL + MODEL." >&2 echo "[hint] start a model server first (bash scripts/switch.sh )" >&2 - echo "[hint] or pass URL=http://... CONTAINER=name MODEL=name as env vars" >&2 + echo "[hint] or pass URL=http://... MODEL=name as env vars" >&2 + echo "[hint] CONTAINER is optional — set CONTAINER=none for host builds" >&2 echo "[got] URL='${URL:-}' CONTAINER='${CONTAINER:-}' MODEL='${MODEL:-}'" >&2 exit 1 fi