aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / evidence / qwen38-serve-fast-20261019 / swap.sh
| 1 | #!/bin/bash |
| 2 | # swap.sh <new-start-script>: stop keepalive, SIGTERM the live 27B (drains the reply in flight), |
| 3 | # install the new start script (old kept as .bak-<ts>), start, wait for /v1/models. Prints timestamps. |
| 4 | set -uo pipefail |
| 5 | S=$HOME/.local/state/aien-q38; NEW=$1; TS=$(date -u +%Y%m%dT%H%M%SZ) |
| 6 | ts() { date -u +%FT%T.%3NZ; } |
| 7 | echo "$(ts) stop keepalive $(cat $S/keepalive.pid)"; kill "$(cat $S/keepalive.pid)" |
| 8 | # Shortest downtime: wait (up to 10 min) for a moment with no client connected, so the drain is empty. |
| 9 | for i in $(seq 1 3000); do [ "$(ss -Htn state established "( sport = :18091 )" | wc -l)" = 0 ] && break; sleep 0.2; done |
| 10 | echo "$(ts) open client connections: $(ss -Htn state established "( sport = :18091 )" | wc -l)" |
| 11 | OLD=$(cat $S/serve.pid) |
| 12 | echo "$(ts) SIGTERM old server $OLD"; T0=$(date +%s.%N); kill -TERM "$OLD" |
| 13 | while kill -0 "$OLD" 2>/dev/null; do sleep 0.2; done |
| 14 | T1=$(date +%s.%N); echo "$(ts) old server exited" |
| 15 | cp -p $S/start-27b.sh $S/start-27b.sh.bak-$TS && cp "$NEW" $S/start-27b.sh && echo "$(ts) start script swapped (backup start-27b.sh.bak-$TS)" |
| 16 | $S/start-27b.sh |
| 17 | until curl -s -m 2 127.0.0.1:18091/v1/models | grep -q qwen3.8-27b-fp8; do |
| 18 | kill -0 "$(cat $S/serve.pid)" 2>/dev/null || { echo "$(ts) NEW SERVER DIED"; exit 1; } |
| 19 | sleep 0.5; done |
| 20 | T2=$(date +%s.%N); echo "$(ts) new server answers /v1/models, pid $(cat $S/serve.pid)" |
| 21 | echo "drain_s=$(echo "$T1 - $T0" | bc) load_s=$(echo "$T2 - $T1" | bc) down_s=$(echo "$T2 - $T0" | bc)" |