25 lines
1.0 KiB
Bash
25 lines
1.0 KiB
Bash
#!/usr/bin/env sh
|
|
# Bounded background control-plane writes for the M15 backup-consistency rehearsal.
|
|
#
|
|
# A logical backup must stay coherent while ModelForge keeps writing. This drives real
|
|
# operational writes (capacity snapshots and SLO evaluations) for a bounded period so the
|
|
# dump is taken against a moving database rather than a quiesced one.
|
|
set -eu
|
|
|
|
BASE_URL="${MODELFORGE_BASE_URL:-http://localhost:8000}"
|
|
DURATION="${M15_WRITE_SECONDS:-90}"
|
|
INTERVAL="${M15_WRITE_INTERVAL:-3}"
|
|
TOKEN="${MODELFORGE_OPERATOR_API_KEY:?operator API key is required}"
|
|
|
|
deadline=$(( $(date +%s) + DURATION ))
|
|
writes=0
|
|
while [ "$(date +%s)" -lt "$deadline" ]; do
|
|
curl -s -o /dev/null -X POST -H "X-ModelForge-Admin-Token: ${TOKEN}" \
|
|
"${BASE_URL}/api/v1/admin/operations/capacity/collect" || true
|
|
curl -s -o /dev/null -X POST -H "X-ModelForge-Admin-Token: ${TOKEN}" \
|
|
"${BASE_URL}/api/v1/admin/operations/slo-evaluations/run" || true
|
|
writes=$(( writes + 2 ))
|
|
sleep "${INTERVAL}"
|
|
done
|
|
printf 'background_write_requests=%s\n' "${writes}"
|