50 lines
1.7 KiB
Bash
50 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# Quick command reference for automation debugging
|
|
|
|
echo "=== AUTOMATION DIAGNOSTICS COMMANDS ==="
|
|
echo ""
|
|
|
|
echo "1. CHECK RUNNING AUTOMATION RUNS:"
|
|
echo "docker exec igny8_backend python manage.py shell << 'EOF'"
|
|
echo "from igny8_core.business.automation.models import AutomationRun"
|
|
echo "runs = AutomationRun.objects.filter(status__in=['running', 'paused'])"
|
|
echo "for r in runs:"
|
|
echo " print(f'{r.run_id} | Site:{r.site_id} | Stage:{r.current_stage} | Status:{r.status}')"
|
|
echo "EOF"
|
|
echo ""
|
|
|
|
echo "2. FORCE CANCEL STUCK RUNS:"
|
|
echo "docker exec igny8_backend python manage.py shell << 'EOF'"
|
|
echo "from igny8_core.business.automation.models import AutomationRun"
|
|
echo "from django.core.cache import cache"
|
|
echo "runs = AutomationRun.objects.filter(status__in=['running', 'paused'])"
|
|
echo "for r in runs:"
|
|
echo " r.status = 'cancelled'"
|
|
echo " r.save()"
|
|
echo " cache.delete(f'automation_lock_{r.site_id}')"
|
|
echo " print(f'Cancelled {r.run_id}')"
|
|
echo "EOF"
|
|
echo ""
|
|
|
|
echo "3. CHECK CACHE LOCKS:"
|
|
echo "docker exec igny8_backend python manage.py shell << 'EOF'"
|
|
echo "from django.core.cache import cache"
|
|
echo "for site_id in [5, 16]:"
|
|
echo " val = cache.get(f'automation_lock_{site_id}')"
|
|
echo " print(f'Site {site_id}: {val or \"UNLOCKED\"}')"
|
|
echo "EOF"
|
|
echo ""
|
|
|
|
echo "4. VIEW AUTOMATION LOGS:"
|
|
echo "ls -lt /data/app/logs/automation/5/*/run_* | head -n 5"
|
|
echo "tail -f /data/app/logs/automation/5/16/run_XXXXX_manual/automation_run.log"
|
|
echo ""
|
|
|
|
echo "5. CHECK CELERY WORKERS:"
|
|
echo "docker exec igny8_celery_worker celery -A igny8_core inspect active"
|
|
echo ""
|
|
|
|
echo "6. RESTART BACKEND (after code changes):"
|
|
echo "docker restart igny8_backend"
|
|
echo ""
|