ops(scripts): dispatch, queue gating, heartbeat, quota probe
dispatch-turn.sh (headless turn launcher with TURN_MODEL routing), queue-after.sh (serial gate chain + quota-wall guard), pmo-heartbeat.sh (PMO wake loop), quota-probe-then-chain.sh (post-wall relaunch).
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# quota-probe-then-chain.sh — wait for z.ai quota window to reset, then
|
||||
# launch the serial build chain. Probe: 8-token glm-4.7-flash ping via the
|
||||
# harness vkey. On first 200 -> fire work-q1..q4 chain and exit.
|
||||
set -uo pipefail
|
||||
VKEY_FILE="$HOME/.coordinate/secrets/mopac-harness-vkey.env"
|
||||
LOG="$HOME/.coordinate/logs/queue.status"
|
||||
PROBE_LOG="$HOME/.coordinate/logs/quota-probe.log"
|
||||
|
||||
while true; do
|
||||
ok=$(bash -c "set -a; source '$VKEY_FILE'; set +a; python3 - <<EOF
|
||||
import os, json, urllib.request, urllib.error
|
||||
body = json.dumps({'model': 'glm-4.7-flash', 'messages': [{'role': 'user', 'content': 'ping'}], 'max_tokens': 8}).encode()
|
||||
req = urllib.request.Request('http://192.168.3.78:4001/v1/chat/completions', data=body, headers={'Authorization': 'Bearer ' + os.environ['HARNESS_LITELLM_KEY'], 'Content-Type': 'application/json'})
|
||||
try:
|
||||
urllib.request.urlopen(req, timeout=30)
|
||||
print('OK')
|
||||
except urllib.error.HTTPError as e:
|
||||
print('HTTP', e.code)
|
||||
except Exception as e:
|
||||
print('ERR', type(e).__name__)
|
||||
EOF" 2>/dev/null)
|
||||
echo "$(date -Is) probe: $ok" >> "$PROBE_LOG"
|
||||
if [ "$ok" = "OK" ]; then
|
||||
echo "$(date -Is) QUOTA BACK — launching build chain" >> "$LOG"
|
||||
W="$HOME/.coordinate/scripts"
|
||||
T="$HOME/.coordinate/inbox-work"
|
||||
screen -dmS work-q1 bash "$W/queue-after.sh" NONE-GATE docs-standards "$T/TASK-20260828-2100-docs-standards.md"
|
||||
screen -dmS work-q2 bash "$W/queue-after.sh" work-q1 events-receiver "$T/TASK-20260828-1975-events-receiver.md"
|
||||
screen -dmS work-q3 bash "$W/queue-after.sh" work-q2 keyproxy-v0 "$T/TASK-20260828-2130-keyproxy-v0.md"
|
||||
screen -dmS work-q4 bash "$W/queue-after.sh" work-q3 selfhost-core "$T/TASK-20260828-2131-selfhost-core.md"
|
||||
echo "$(date -Is) chain armed: docs -> events -> keyproxy-v0 -> selfhost-core" >> "$LOG"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1200
|
||||
done
|
||||
Reference in New Issue
Block a user