adv-cache-3 run-box.sh: through the ranked lease, no -c string (main's inline-rm rule of 21:33 BST)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-07 20:36:51 +00:00
parent c0b4fc3445
commit ff8afa731f

View file

@ -1,17 +1,19 @@
#!/usr/bin/env bash
# Start one adv-cache-3 sweep on a build box (run ON the box). Internal adversarial pass, not an independent review.
# run-box.sh <tag> <args...>
# The binary is /srv/builds/_adv-cache-3/bin/adv-cache-3 (copied there after tools/build-remote.sh; the worktree mirror's
# target dir is not used at run time). The log and pid file live under /srv/builds/_adv-cache-3/logs/<tag>.log{,.pid},
# outside the worktree mirror, which build-remote.sh's source sync would wipe. The run takes the per-box sweep lock
# (/srv/builds/_adv/locks/sweep.lock, coordinator's rule of 19:55 BST, 7 October 2026: one sweep per box at a time, up to 88
# threads), runs at nice 10 on cores 8 to 95 (0 to 7 reserved), no SIGSTOP yield. Kill by pid file only: kill $(cat <pid>).
# run-box.sh <tag> <args...> (THREADS=N caps the pool ask; default 32, the ceiling an adv holder keeps)
# The binary is /srv/builds/_adv-cache-3/bin/adv-cache-3 (copied there after tools/build-remote.sh). The log and pid file
# live under /srv/builds/_adv-cache-3/logs/<tag>.log{,.pid}, outside the worktree mirror, which build-remote.sh's source
# sync would wipe. Every sweep starts through the build-server lane's ranked lease (main, 7 October 2026, 20:1x and 20:40
# BST: `lease pool`, class adv, holders above 32 threads are pre-empted), pinned by the lease to the cores it took, at
# nice 10, never on cores 0 to 7; "{cores}" in the arguments becomes the count taken. No `-c` string, no inline rm
# (main, 21:33 BST). Kill by pid file only: kill $(cat <pid>).
set -euo pipefail
tag="$1"; shift
BIN=/srv/builds/_adv-cache-3/bin/adv-cache-3
DIR=/srv/builds/_adv-cache-3/logs
T="${THREADS:-32}"
mkdir -p "$DIR"
log="$DIR/$tag.log"
nohup flock /srv/builds/_adv/locks/sweep.lock -c "nice -n 10 taskset -c 8-95 $BIN $* >> '$log' 2>&1" > /dev/null 2>&1 &
nohup /srv/builds/_bin/lease pool "$T" --min 16 --label "adv-cache-3 $tag" --owner adv-cache-3 -- "$BIN" "$@" >> "$log" 2>&1 &
echo $! > "$log.pid"
echo "started $tag pid $(cat "$log.pid") log $log (waits for the sweep lock if held)"
echo "started $tag pid $(cat "$log.pid") log $log (waits in the lease queue while fewer than 16 pool cores are free)"