chore: add debug script to check job placements and render order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-03 11:22:59 +00:00
parent 64a3fa2bef
commit c32302ad2f

43
scripts/check_job.py Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Check job edit state and placements for debugging render order issues."""
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "backend"))
from dotenv import load_dotenv
load_dotenv(os.path.join(os.path.dirname(__file__), "..", "backend", ".env"))
from pymongo import MongoClient
from app.core.config import settings
db = MongoClient(settings.mongodb_uri)[settings.mongodb_db]
# Both problem jobs
job_ids = [
"69a0675634e072d880ef7205", # de-v1fv (render not updating)
"69a00adb3c66801f7d23fe5b", # de-v2fv (out of order: 0 1 2 3 4 5 8 6 9 10 7)
]
for job_id in job_ids:
job = db.jobs.find_one({"_id": job_id}, {"title": 1, "outputs": 1, "status": 1})
if not job:
print(f"Job {job_id} not found")
continue
print("=" * 70)
print(f"Job: {job_id}")
print(f"Title: {job.get('title')}")
print(f"Status: {job.get('status')}")
outputs = job.get("outputs", {})
for lang, data in outputs.items():
print(f"\nLanguage: {lang}")
es = data.get("accessible_video_edit_state", {})
placements = es.get("placements", [])
print(f"Placements ({len(placements)}):")
for p in placements:
cue = p.get("ad_cue_index", "?")
pp = p.get("pause_point", 0)
text = p.get("ad_text", "")[:60]
print(f" cue={cue:>2} pause_point={pp:>8.3f} {text}")
print()