| #!/usr/bin/env bash | |
| # Re-occupy GPU3: relaunch the JSL-Med-9B-v3.2 vLLM server (port 8010). | |
| set -uo pipefail | |
| SERVE_SCRIPT=/mnt/data/zainulabideen/aws/serve_jsl_9b_v3_2.sh | |
| LOG=/mnt/data/zainulabideen/Data/RV3/fine_tune/logs/serve_jsl_9b_v3_2_resume.log | |
| echo ">> checking GPU3 is free before starting..." | |
| USED=$(nvidia-smi -i 3 --query-gpu=memory.used --format=csv,noheader,nounits) | |
| if [ "$USED" -gt 5000 ]; then | |
| echo ">> GPU3 has ${USED} MiB in use — someone else may be using it. Run free-gpu3.sh first if that's stale." | |
| exit 1 | |
| fi | |
| echo ">> launching JSL-Med-9B-v3.2 on GPU3, port 8010..." | |
| nohup bash "$SERVE_SCRIPT" > "$LOG" 2>&1 & | |
| disown | |
| echo ">> launched, PID $!" | |
| echo ">> waiting for health check..." | |
| for i in $(seq 1 40); do | |
| r=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8010/v1/models -H "Authorization: Bearer jsl-1" 2>/dev/null) | |
| if [ "$r" == "200" ]; then | |
| echo ">> HEALTHY after ${i}0s" | |
| exit 0 | |
| fi | |
| sleep 10 | |
| done | |
| echo ">> WARNING: not healthy after 400s, check $LOG" | |