Forward-port lab3 SQLAlchemy and Alembic foundation
Carry sourcef591fa64e5forward from72a1e57. Preserve lab4 attachment transactions, reconciliation locks, quarantine, and existing schema data through verified legacy adoption. Keep report and evidence work in progress untouched.
This commit is contained in:
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
out=${1:?usage: docker-stats.sh <csv>}
|
||||
vm=$(dirname "$out")/vm_stat.csv
|
||||
cd "$(dirname "$0")/.."
|
||||
project=$(docker compose config | sed -n 's/^name: //p')
|
||||
echo 'ts,name,cpu_pct,mem_usage,mem_pct,net_io,block_io,pids' > "$out"
|
||||
echo 'ts,busy,total,cpus' > "$vm"
|
||||
while :; do
|
||||
ts=$(date +%s)
|
||||
docker compose exec -T valkey cat /proc/stat 2>/dev/null | awk -v ts="$ts" '/^cpu /{b=$2+$3+$4+$7+$8+$9; t=b+$5+$6} /^cpu[0-9]/{n++} END{if (t) print ts "," b "," t "," n}' >> "$vm" || true
|
||||
ids=$(docker ps -q --filter "label=com.docker.compose.project=$project")
|
||||
[ -z "$ids" ] || docker stats --no-stream --format "$ts,{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.MemPerc}},{{.NetIO}},{{.BlockIO}},{{.PIDs}}" $ids >> "$out" || true
|
||||
sleep "${INTERVAL:-1}"
|
||||
done
|
||||
Reference in New Issue
Block a user