Files
momentry_core/scripts/monitor_pipeline_queue.sh
Accusys 63fbbe1225 release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes:
- Pipeline Queue integration completed (internal.file + pipeline.commands)
- Fixed old job_worker database compatibility with new command_queue table
- Compiled Swift OCR binary (was missing, causing empty OCR results)
- Added deep scan functionality through re-scan API

Fixes:
- Changed CommandJob.id from i32 to i64 for database compatibility
- Added UUID generation in create_command (message_id field)
- Fixed claim_pending_commands to query queue_name = 'internal.file'
- Fixed field mappings: command_id → message_id, job_type → command_type
- Added support for 'processing' status in CommandJobStatus

Queue System:
- internal.file queue: for register/unregister/re-scan commands (job_worker)
- pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker)

Documentation:
- Added comprehensive queue system documentation
- Created M4 workspace status reports
- Updated AGENTS.md with queue system details
2026-10-12 10:00:51 +08:00

73 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Pipeline Queue Monitor Script
# Usage: ./monitor_pipeline_queue.sh
API_KEY="muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
DB="momentry"
echo "==================================="
echo "Pipeline Queue Monitor"
echo "Time: $(date '+%Y-%m-%d %H:%M:%S')"
echo "==================================="
echo ""
# Queue Statistics
echo "📊 Queue Statistics:"
echo "---"
/opt/homebrew/Cellar/libpq/18.4/bin/psql -U accusys -d $DB -c "
SELECT
queue_name,
status,
COUNT(*) as count
FROM command_queue
GROUP BY queue_name, status
ORDER BY queue_name, status;
" 2>/dev/null
echo ""
# Processing Commands
echo "⏳ Processing Commands:"
echo "---"
/opt/homebrew/Cellar/libpq/18.4/bin/psql -U accusys -d $DB -c "
SELECT
message_id,
command_category,
processing_started_at,
NOW() - processing_started_at as duration
FROM command_queue
WHERE status = 'processing'
ORDER BY processing_started_at;
" 2>/dev/null
echo ""
# Recent Failed Commands
echo "❌ Recent Failed Commands (last 10):"
echo "---"
/opt/homebrew/Cellar/libpq/18.4/bin/psql -U accusys -d $DB -c "
SELECT
message_id,
command_category,
LEFT(last_error, 80) as error_preview
FROM command_queue
WHERE status = 'failed'
ORDER BY created_at DESC
LIMIT 10;
" 2>/dev/null
echo ""
# Worker Status
echo "🔄 Worker Status:"
echo "---"
echo "Pipeline Worker: $(ps aux | grep pipeline_worker | grep -v grep | awk '{print "Running (PID "$2")"}' || echo 'Not running')"
echo "Job Worker: $(ps aux | grep 'momentry worker' | grep -v grep | awk '{print "Running (PID "$2")"}' || echo 'Not running')"
echo ""
echo "==================================="
echo "Commands:"
echo " Reset stuck: /opt/homebrew/Cellar/libpq/18.4/bin/psql -U accusys -d $DB -c \"UPDATE command_queue SET status = 'pending', processing_started_at = NULL WHERE status = 'processing';\""
echo " View logs: tail -f /Users/accusys/momentry_core/logs/pipeline_worker.log"
echo "==================================="