Upload boot-with-log.sh with huggingface_hub
Browse files- boot-with-log.sh +25 -0
boot-with-log.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Diagnostic wrapper: runs the normal Krea 2 bootstrap and uploads its log,
|
| 3 |
+
# plus disk and process snapshots, to a private Hugging Face dataset every 60 s.
|
| 4 |
+
L=/tmp/boot.log
|
| 5 |
+
: > "$L"
|
| 6 |
+
(/bootstrap-models.sh >>"$L" 2>&1; echo "BOOTSTRAP EXITED $?" >>"$L") &
|
| 7 |
+
upload() {
|
| 8 |
+
{
|
| 9 |
+
echo "=== $(date -u +%FT%TZ) uptime $(cut -d' ' -f1 /proc/uptime)s"
|
| 10 |
+
df -h /comfyui /tmp 2>&1 | tail -3
|
| 11 |
+
ls -la /comfyui/models/unet /comfyui/models/clip /comfyui/models/vae 2>&1 | grep -v '^total'
|
| 12 |
+
ps -eo pid,etime,pcpu,args --sort=-pcpu 2>/dev/null | head -8
|
| 13 |
+
nvidia-smi --query-gpu=name,memory.used,memory.total,utilization.gpu --format=csv,noheader 2>&1
|
| 14 |
+
echo "=== last 120 log lines"
|
| 15 |
+
tail -120 "$L"
|
| 16 |
+
} > /tmp/snap.txt 2>&1
|
| 17 |
+
B64=$(base64 -w0 /tmp/snap.txt)
|
| 18 |
+
printf '{"key":"header","value":{"summary":"boot log %s"}}\n{"key":"file","value":{"content":"%s","path":"%s/boot.txt","encoding":"base64"}}\n' \
|
| 19 |
+
"$(date -u +%T)" "$B64" "${RUNPOD_POD_ID:-worker}" > /tmp/commit.ndjson
|
| 20 |
+
curl -s -m 60 -X POST "https://huggingface.co/api/datasets/${LOG_REPO}/commit/main" \
|
| 21 |
+
-H "Authorization: Bearer ${LOG_TOKEN}" -H "Content-Type: application/x-ndjson" \
|
| 22 |
+
--data-binary @/tmp/commit.ndjson > /tmp/commit.out 2>&1
|
| 23 |
+
}
|
| 24 |
+
sleep 20; upload
|
| 25 |
+
while true; do sleep 60; upload; done
|