← back to Designer Wallcoverings
supervise.sh: auto-relaunch wrapper for resumable local-LLM jobs — survives Mac2 memory-pressure jetsam kills (rc==0 + no-new-rows = complete)
bc93546c282f3fe797d879fb6d5b638c5777f9e6 · 2026-07-01 14:33:16 -0700 · Steve
Files touched
A onboarding/sangetsu-lilycolor/scripts/supervise.sh
Diff
commit bc93546c282f3fe797d879fb6d5b638c5777f9e6
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Jul 1 14:33:16 2026 -0700
supervise.sh: auto-relaunch wrapper for resumable local-LLM jobs — survives Mac2 memory-pressure jetsam kills (rc==0 + no-new-rows = complete)
---
onboarding/sangetsu-lilycolor/scripts/supervise.sh | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/onboarding/sangetsu-lilycolor/scripts/supervise.sh b/onboarding/sangetsu-lilycolor/scripts/supervise.sh
new file mode 100755
index 00000000..21f9c413
--- /dev/null
+++ b/onboarding/sangetsu-lilycolor/scripts/supervise.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+# supervise.sh — keep a resumable local-LLM job alive across external kills.
+#
+# Mac2 memory pressure (swap thrash) periodically jetsam-kills the enrichment /
+# translation python processes mid-run. The wrapped scripts are RESUMABLE and
+# HARDENED (retry/defer on transient ollama-down or Henry-unmount, never burn a
+# SKU), so a kill costs seconds, not data. This wrapper relaunches within ~5s of
+# any non-clean exit until the job genuinely completes.
+#
+# Completion signal = a CLEAN exit (rc==0) that produced NO new output rows.
+# - A kill (jetsam/SIGKILL) yields rc!=0 -> always relaunch.
+# - A productive pass yields rc==0 + new rows -> loop to continue remaining work.
+# - A pass that exits clean with nothing new -> the job is done -> stop.
+# This needs no fragile log-marker matching and works for both jobs identically.
+#
+# Usage: supervise.sh <label> <script-rel-path> <output-file> <log-file>
+set -u
+LABEL="$1"; SCRIPT="$2"; OUT="$3"; LOG="$4"
+HERE="$(cd "$(dirname "$0")/.." && pwd)"
+cd "$HERE" || exit 1
+
+count() { wc -l < "$OUT" 2>/dev/null | tr -d ' ' || echo 0; }
+
+echo "[$(date +%H:%M:%S)] supervisor($LABEL) start" >> "$LOG"
+while true; do
+ before="$(count)"
+ python3 "$SCRIPT" >> "$LOG" 2>&1
+ rc=$?
+ after="$(count)"
+ if [ "$rc" -eq 0 ] && [ "$before" = "$after" ]; then
+ echo "[$(date +%H:%M:%S)] supervisor($LABEL) COMPLETE (clean exit, no new rows at ${after}) — stopping" >> "$LOG"
+ break
+ fi
+ echo "[$(date +%H:%M:%S)] supervisor($LABEL) pass ended rc=$rc rows ${before}->${after} — relaunch in 5s" >> "$LOG"
+ sleep 5
+done
← fff3bcbc phase3 orphan recovery: $0 ai_tags derivation backfill (18,3
·
back to Designer Wallcoverings
·
harden local-recover: completeness guard so a dead driver ca f3581a99 →