#!/usr/bin/env bash # Overnight orchestrator: run all experiments back-to-back, unattended. # 1. Tier-1 headline sweep (tf_run_tier1.sh) # 2. K-sweep (new K only) (tf_run_ksweep.sh) # 3. window-position sweep (tf_run_window_sweep.sh) # 4. global-vs-sliding ablation (tf_run_ablation.sh) # Each job saves its own timestamped summary JSON + per-item JSONL (for later # re-aggregation) + console log. Robust: a failure in one job is logged and the # orchestrator continues to the next, so you don't wake up to a halted queue. # # Usage: bash scripts/tf_run_all.sh (or: nohup bash scripts/tf_run_all.sh & to detach) set -uo pipefail # NOTE: no -e; we want to continue past a failing job cd "$(dirname "$0")/.." STAMP="$(date +%Y%m%d-%H%M%S)" MASTER="run_all_${STAMP}.log" run_job () { local name="$1" echo "" echo "############################################################" echo "## $name :: STARTED $(date)" echo "############################################################" if bash "scripts/$name"; then echo "## $name :: OK $(date)" else echo "## $name :: FAILED (rc=$?) $(date) — continuing" fi } { echo "#### overnight run ${STAMP} git=$(git rev-parse --short HEAD 2>/dev/null || echo unknown) ####" echo "#### jobs: tf_run_tier1.sh, tf_run_ksweep.sh, tf_run_window_sweep.sh, tf_run_ablation.sh ####" SECONDS=0 run_job tf_run_tier1.sh run_job tf_run_ksweep.sh run_job tf_run_window_sweep.sh run_job tf_run_ablation.sh echo "" echo "#### ALL JOBS DONE $(date) (total $((SECONDS / 60)) min) ####" } 2>&1 | tee "${MASTER}"