File size: 1,097 Bytes
7ffeb0f
 
 
 
 
 
 
 
 
ef8a11d
7ffeb0f
 
 
 
 
 
274b7fb
 
 
 
7ffeb0f
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os, sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from dotenv import load_dotenv
load_dotenv(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '.env'))
import db

c = db.get_client()

# Show any non-done rows
res = c.table('saved_reels').select('id,url,status,source,created_at,error,attempt_count,processing_started_at,next_attempt_at').in_('status', ['pending', 'processing', *db.FAILURE_STATUSES]).order('created_at', desc=True).limit(10).execute()
rows = res.data or []
print(f'Non-done rows in queue: {len(rows)}')
for r in rows:
    url = (r['url'] or 'NO URL')[:60]
    err = (r.get('error') or '')[:60]
    src = (r.get('source') or '')[:8]
    attempts = r.get("attempt_count") or 0
    started = r.get("processing_started_at") or "-"
    next_at = r.get("next_attempt_at") or "-"
    print(f"  {r['status']:<18} | tries={attempts} | started={started} | next={next_at} | {src:<8} | {url} | err={err}")

# Also show total row count
total = c.table('saved_reels').select('id', count='exact').execute()
print(f'Total rows: {total.count}')