Release: dev → main (first public release) #258
+19
-14
@@ -335,26 +335,30 @@ def test_recover_stalled_task_runs_ml_queue_uses_longer_threshold(db_sync):
|
||||
"""ml-queue tasks (embed_image video branch) legitimately run
|
||||
past the default 5-min threshold. The sweep must NOT flag an
|
||||
ml-queue task that's only been running 10 min — the override
|
||||
threshold (25 min via QUEUE_STUCK_THRESHOLD_MINUTES) protects
|
||||
in-flight video tagging. Operator-flagged 2026-05-28 after
|
||||
image 6288 (mp4) was marked failed at the 5-min tick mid-run."""
|
||||
threshold (QUEUE_STUCK_THRESHOLD_MINUTES["ml"]) protects in-flight
|
||||
video tagging. Operator-flagged 2026-05-28 after image 6288 (mp4)
|
||||
was marked failed at the 5-min tick mid-run. Read from the table
|
||||
rather than restated: the value moved 25 -> 40 in #4432."""
|
||||
from sqlalchemy import select
|
||||
|
||||
from backend.app.models import TaskRun
|
||||
from backend.app.tasks.maintenance import recover_stalled_task_runs
|
||||
from backend.app.tasks.maintenance import (
|
||||
QUEUE_STUCK_THRESHOLD_MINUTES,
|
||||
recover_stalled_task_runs,
|
||||
)
|
||||
|
||||
ml_threshold = QUEUE_STUCK_THRESHOLD_MINUTES["ml"]
|
||||
now = datetime.now(UTC)
|
||||
# 10-min-old ml-queue row: stale by the default 5-min rule but
|
||||
# fresh by the 25-min ml override. Must survive the sweep.
|
||||
# fresh by the ml override. Must survive the sweep.
|
||||
ml_fresh_id = _make_task_run(
|
||||
db_sync, status="running", queue="ml",
|
||||
started_at=now - timedelta(minutes=10),
|
||||
)
|
||||
# 30-min-old ml-queue row: past even the ml override. Must be
|
||||
# flagged.
|
||||
# Past even the ml override. Must be flagged.
|
||||
ml_stale_id = _make_task_run(
|
||||
db_sync, status="running", queue="ml",
|
||||
started_at=now - timedelta(minutes=30),
|
||||
started_at=now - timedelta(minutes=ml_threshold + 5),
|
||||
)
|
||||
db_sync.commit()
|
||||
|
||||
@@ -431,9 +435,10 @@ def test_download_stuck_threshold_exceeds_hard_time_limit():
|
||||
def test_recover_stalled_task_runs_archive_task_uses_longer_threshold(db_sync):
|
||||
"""import_archive_file shares the 'import' queue with fast
|
||||
single-file import_media_file, so it gets a per-task-name override
|
||||
(40 min) while the import queue stays at the 5-min default. A
|
||||
10-min-old archive task-run must survive; a 50-min-old one is
|
||||
flagged. Operator-flagged 2026-05-28."""
|
||||
(40 min) while the import queue keeps its short threshold (10 min
|
||||
since #4432; import_media_file's hard limit is 6). A 10-min-old
|
||||
archive task-run must survive; a 50-min-old one is flagged.
|
||||
Operator-flagged 2026-05-28."""
|
||||
from sqlalchemy import select
|
||||
|
||||
from backend.app.models import TaskRun
|
||||
@@ -441,12 +446,12 @@ def test_recover_stalled_task_runs_archive_task_uses_longer_threshold(db_sync):
|
||||
|
||||
archive_name = "backend.app.tasks.import_file.import_archive_file"
|
||||
now = datetime.now(UTC)
|
||||
# Fast single-file import on the same queue, 10 min old → flagged
|
||||
# by the default 5-min rule.
|
||||
# Fast single-file import on the same queue, 15 min old → flagged
|
||||
# by the import queue's 10-min threshold.
|
||||
media_id = _make_task_run(
|
||||
db_sync, status="running", queue="import",
|
||||
task_name="backend.app.tasks.import_file.import_media_file",
|
||||
started_at=now - timedelta(minutes=10),
|
||||
started_at=now - timedelta(minutes=15),
|
||||
)
|
||||
# Archive on the same queue, 10 min old → survives (40-min override).
|
||||
archive_fresh_id = _make_task_run(
|
||||
|
||||
Reference in New Issue
Block a user