igneum/tools/attack/adv-accept/run-box.sh
igneum-labs 01f8a109fc adv-accept: run-box.sh through lease pool (no sweep.lock); attempts census prints progress
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 19:24:45 +00:00

18 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# Start a long adv-accept run on a build box through the build-server lane's lease pool (main, 7 October 2026, 20:17 UK:
# no sweep starts except through `lease pool`): up to <threads> free cores of the bounded pool (cores 8 to 95, shared with
# the builds), never fewer than <min>, waiting up to 2 h; then nice 10 pinned to the cores taken. The command's
# "--threads {cores}" becomes the count taken (LEASE_CORES is exported too, for a loop of runs). No sweep.lock flock.
# Logs and pid files OUTSIDE the worktree mirror: /srv/builds/_adv-adv-accept/<tag>.log, .pid (the lease), .pgid.
# Kill ONLY by pid file: kill -- -"$(cat <log>.pgid)".
# run-box.sh <tag> <threads> <min> <cmd...> (cmd may be: bash -c '...' using $LEASE_CORES)
set -euo pipefail
tag="$1"; threads="$2"; min="$3"; shift 3
dir=/srv/builds/_adv-adv-accept
mkdir -p "$dir"
log="$dir/$tag.log"
setsid /srv/builds/_bin/lease pool "$threads" --min "$min" --label "adv-accept $tag" --owner adv-accept -- "$@" > "$log" 2>&1 < /dev/null &
pid=$!
pgid=$(ps -o pgid= -p "$pid" 2>/dev/null | tr -d ' '); [ -n "$pgid" ] || pgid="$pid"
echo "$pid" > "$log.pid"; echo "$pgid" > "$log.pgid"
echo "$(date -u +%FT%TZ) queued on lease pool $threads (min $min) pid $pid pgid $pgid; log $log" | tee -a "$log.start"