e0d04e242f
- Add Rust face processor module (detection, embedding, tracking, qdrant) - Add Facenet CoreML/ONNX conversion scripts and tests - Refactor swift_face into Sources/swift_face with ArgumentParser support - Update store_traced_faces to handle face.json correctly - Fix ASRX parsing and TKG bbox reading from Qdrant - Improve admin_config and trace_agent APIs - Add M4 workspace docs for face clustering, dedup, and Facenet validation - Fix worker heartbeat TTL (poll_interval x 3, min 60s) for offline detection
57 lines
1.6 KiB
Bash
Executable File
57 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Worker 監控腳本
|
|
|
|
echo "=== Worker 狀態監控 ==="
|
|
echo "時間: $(date)"
|
|
echo ""
|
|
|
|
# 1. 檢查 Worker 進程
|
|
echo "1. Worker 進程:"
|
|
ps aux | grep -E "momentry.*worker" | grep -v grep | awk '{printf " PID: %s, CPU: %s%%, MEM: %s%%\n", $2, $3, $4}'
|
|
echo ""
|
|
|
|
# 2. 檢查並發任務
|
|
echo "2. 並發任務:"
|
|
ps aux | grep -E "python.*momentry|rust_face_processor|swift_face" | grep -v grep | wc -l | awk '{print " 活躍進程數: " $1}'
|
|
echo ""
|
|
|
|
# 3. 檢查內存壓力
|
|
echo "3. 內存使用:"
|
|
top -l 1 | grep "PhysMem" | awk '{print " " $0}'
|
|
echo ""
|
|
|
|
# 4. 檢查最近的錯誤
|
|
echo "4. 最近錯誤(最近 10 條):"
|
|
tail -100 logs/worker_3002_manual.log | grep -E "ERROR|WARN|timeout|stuck" | tail -10
|
|
echo ""
|
|
|
|
# 5. 檢查 slot 使用(從日誌推斷)
|
|
echo "5. Slot 使用估計:"
|
|
FRAME_COUNT=$(ps aux | grep -E "rust_face_processor|swift_face" | grep -v grep | wc -l)
|
|
TIME_COUNT=$(ps aux | grep -E "python.*asr|python.*cut" | grep -v grep | wc -l)
|
|
FACE_IO_COUNT=$(ps aux | grep -E "python.*store_traced|python.*tkg" | grep -v grep | wc -l)
|
|
|
|
echo " Frame slot: $FRAME_COUNT / 4"
|
|
echo " Time slot: $TIME_COUNT / 2"
|
|
echo " Face I/O: $FACE_IO_COUNT / 4"
|
|
echo ""
|
|
|
|
# 6. 檢查是否達到上限
|
|
TOTAL_RUNNING=$(ps aux | grep -E "momentry|python.*momentry|rust_face_processor|swift_face" | grep -v grep | wc -l)
|
|
if [ $TOTAL_RUNNING -ge 20 ]; then
|
|
echo "⚠️ 警告: 活躍進程數過多 ($TOTAL_RUNNING)"
|
|
fi
|
|
|
|
if [ $FRAME_COUNT -ge 4 ]; then
|
|
echo "⚠️ 警告: Frame slot 已滿"
|
|
fi
|
|
|
|
if [ $TIME_COUNT -ge 2 ]; then
|
|
echo "⚠️ 警告: Time slot 已滿"
|
|
fi
|
|
|
|
if [ $FACE_IO_COUNT -ge 4 ]; then
|
|
echo "⚠️ 警告: Face I/O slot 已滿"
|
|
fi
|