Scripts only, nothing runs in serving: q245_prep/orig/orig_job/window/freeze/port/analyze/pad/codex_job; cell.py gains --agents-md / --config-extra. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
31 lines
2.0 KiB
Bash
31 lines
2.0 KiB
Bash
#!/usr/bin/env bash
|
|
# A holder-free window for q245_orig_job.sh, started DETACHED by a queue stub that has touched jobs/STOP and closed the holder's descriptor (the mechanism of
|
|
# the single-copy and service-validation windows): q245_window.sh LABEL (environment Q_RUNS is passed through)
|
|
# 1. waits until the lab holder has ended and its memfd is gone; 2. runs q245_orig_job.sh; 3. ALWAYS restarts the lab holder afterwards
|
|
# (single-copy-holder.sh, the O_DIRECT seal), so the queue goes on, whatever happened.
|
|
set -u
|
|
LABEL=${1:-window}
|
|
Q=/data/leleka-e2e/quality-245k
|
|
H=$HOME/work/gpu-runs/holder2
|
|
NOTES=/data/leleka-e2e/decode/notes.md
|
|
note() { echo "[$(date -u +%FT%TZ)] [DEV quality-245k] $*" >> "$NOTES"; }
|
|
restart_holder() {
|
|
if pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null; then echo "a holder is already running"; return; fi
|
|
rmdir "$HOME/work/gpu-runs/MODEL.lock" 2>/dev/null # ours, if the payload died holding it
|
|
rm -f "$H/jobs/STOP" "$H/jobs/READY"
|
|
( cd "$H" && setsid nohup bash /data/leleka-e2e/single-copy/tools/single-copy-holder.sh > "$H/holder3.out" 2>&1 < /dev/null & )
|
|
note "window $LABEL over: holder restarted with single-copy-holder.sh (holder3.out); queue open again"
|
|
}
|
|
trap restart_holder EXIT
|
|
note "window $LABEL: waiting for the holder to end (jobs/STOP is set), then ${Q_PAYLOAD:-q245_orig_job.sh}: ${Q_RUNS:-${QC_MODE:-}}"
|
|
for _ in $(seq 1 1440); do
|
|
if ! pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null && [ ! -d "$HOME/work/gpu-runs/MODEL.lock" ]; then break; fi
|
|
sleep 5
|
|
done
|
|
if pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null; then note "window $LABEL: the holder did not end in 2 h, giving up (holder left as it is)"; trap - EXIT; exit 3; fi
|
|
sleep 5
|
|
note "window $LABEL: holder gone, MemAvailable $(awk '/^MemAvailable:/{printf "%d GiB", $2/1048576}' /proc/meminfo); starting"
|
|
PAYLOAD=${Q_PAYLOAD:-q245_orig_job.sh}
|
|
bash "$Q/tools/$PAYLOAD" > "$Q/window-$LABEL.out" 2>&1
|
|
note "window $LABEL: $PAYLOAD ended rc=$?; log $Q/window-$LABEL.out"
|