Download tools/governor.sh from RightNowAI/RightNow-Mini: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/tools/governor.sh
- Command line
-
hf download hf://RightNowAI/RightNow-Mini/tools/governor.sh
-
curl -L -o governor.sh https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/tools/governor.sh
2.24 kB
| # Keeps one task from taking the whole machine. A benchmark test that starts one thread per core (scikit-learn does) | |
| # took 222 of 256 cores and slowed every other run on 2026-12-01. | |
| # Twice a second, each new container is given its own block of cores, so a program inside sees that many cores and | |
| # sizes its thread pool to them (a time quota alone would leave it starting 224 threads on a few cores' worth of time): | |
| # scoring containers (the benchmark's tests): 16 cores agent task containers: 8 cores (set by the wrapper too) | |
| # model servers for generation and evaluation: cores 48-255 | |
| # one scikit-learn instance of the subset whose test collapses when its cores are shared (even a block kept for it | |
| # collapsed once several runs were scored at the same time): its container is stopped here, so the run records an | |
| # error for it, and eval/rescore.sh scores it alone. Every run is treated this way. | |
| # The limit has to land before the tests start. With the first version of this script (every 10 s) it sometimes landed | |
| # after: the test then ran hundreds of threads on 16 cores and ran out of time (see eval/rescore.sh). | |
| # Cores 0 to 31 are never given out here: they are kept for the speed measurements and for eval/rescore.sh, which sets | |
| # its own containers' cores. Each container is set once. | |
| # bash tools/governor.sh (run on the node, in tmux) | |
| set -u | |
| D=/usr/bin/docker | |
| SEEN=/tmp/mini_governor_seen3.txt | |
| : > "$SEEN" | |
| n=0 | |
| while true; do | |
| for c in $($D ps --format '{{.Names}}'); do | |
| grep -qxF "$c" "$SEEN" && continue | |
| n=$((n + 1)) | |
| case "$c" in | |
| sweb.eval.*-rescore) ;; | |
| sweb.eval.scikit-learn__scikit-learn-14710.*) $D kill "$c" >/dev/null 2>&1 ;; # always scored alone, see above | |
| sweb.eval.*|swesmith.*) b=$(( (n % 13) * 16 + 48 )); $D update --cpus 0 --cpuset-cpus "$b-$((b + 15))" "$c" >/dev/null 2>&1 ;; | |
| minisweagent-*) b=$(( (n % 26) * 8 + 48 )); $D update --cpus 0 --cpuset-cpus "$b-$((b + 7))" "$c" >/dev/null 2>&1 ;; | |
| mini-*) $D update --cpuset-cpus 48-255 "$c" >/dev/null 2>&1 ;; | |
| *) ;; | |
| esac | |
| echo "$c" >> "$SEEN" | |
| done | |
| sleep 0.5 | |
| done | |