clipwright/tests/test_clip_render_order.py
victorcavero14 d4480c6257 feat(queue): auto-retry transient failures, resume on shutdown, queue position
- A job that fails for a reason on our side (CUDA/OOM, NVENC, cublas,
  Gemini 5xx, no clip rendered) is re-queued once after 30 s, keeping its
  reservation and transcript checkpoint. Content failures stay final.
- main.py renders clips best-score first and retries each failed clip once.
- A deploy's drain timeout no longer fails and refunds running jobs: the
  child is killed, the manifest kept, and the next instance resumes it
  (22-sep-2026: 6 jobs failed at once this way). Mid-render manifests are
  resumed instead of being recovered as completed.
- /api/status returns the queue position and an ETA; the dashboard shows
  it with a 'paid plans skip the line' upsell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-22 23:48:23 +02:00

18 lines
548 B
Python

"""The strongest clip renders first, so it is the first one the user sees."""
import pytest
main = pytest.importorskip("main")
def test_best_score_first():
shorts = [{"predicted_score": 40}, {"predicted_score": 91}, {"predicted_score": 77}]
assert main.clip_render_order(shorts) == [1, 2, 0]
def test_unscored_keep_order_after_scored():
shorts = [{}, {"predicted_score": "60"}, {"predicted_score": None}, {}]
assert main.clip_render_order(shorts) == [1, 0, 2, 3]
def test_empty():
assert main.clip_render_order([]) == []