feat(@projects/@magic-civilization): add parallel worker cooldown delay

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-19 14:48:05 -07:00
parent c586688d41
commit fb2f800677

View file

@ -22,6 +22,9 @@
# PARALLEL — Max seeds to run concurrently (default 1 = serial).
# Remote runner is concurrency-safe via scoped pkill per AUTO_PLAY_DIR.
# Apricot has 64 cores → PARALLEL=10 is a safe, ~10× wall-clock speedup.
# LAUNCH_COOLDOWN — Seconds to sleep between launching each parallel worker (default 0).
# Use 1020 on memory-constrained hosts to stagger Godot init spikes
# so games never all peak-initialize simultaneously (prevents OOM crashes).
# SEED_OFFSET — Shift the seed range from [1..COUNT] to [1+OFFSET..COUNT+OFFSET]
# (default 0). Use for multi-sweep runs that share a parent
# results_dir and need disjoint seed numbers (e.g. Task #10
@ -70,6 +73,7 @@ AUTOPLAY_HOST="${AUTOPLAY_HOST:-}"
REMOTE_BATCH_ROOT="${REMOTE_BATCH_ROOT:-/tmp/@magic-civilization/builds}"
SAFETY_TIMEOUT=$(( TURN_LIMIT * 2 + 300 ))
PARALLEL="${PARALLEL:-1}"
LAUNCH_COOLDOWN="${LAUNCH_COOLDOWN:-0}"
# SEED_OFFSET shifts the seed range from [1..COUNT] to [1+OFFSET..COUNT+OFFSET].
# Used by multi-sweep aggregation (e.g. Task #10 B5 AI_PIN_PERSONALITY rotation)
@ -310,6 +314,7 @@ else
wait -n 2>/dev/null || break
done
_run_one "$seed" &
[ "${LAUNCH_COOLDOWN}" -gt 0 ] 2>/dev/null && sleep "$LAUNCH_COOLDOWN" || true
done
wait
fi