Files
Aurora-Core/app/workers/tasks.py
T

29 lines
1022 B
Python
Raw Normal View History

2026-09-04 17:34:03 -05:00
"""arq task functions. Thin wrappers around the ingestion runner so retry/
concurrency/observability behavior lives in arq's worker loop, not here.
Each task receives the `IngestionJob` row's id (created synchronously by the
enqueuing endpoint via `get_or_create_ingestion_job`, *not* generated here)
so status polling has a real, immediately-valid id to look up from the
moment the HTTP response comes back.
2026-09-04 17:34:03 -05:00
"""
from __future__ import annotations
import uuid
2026-09-04 17:34:03 -05:00
from typing import Any
from app.core.logging import get_logger
from app.services.ingestion.runner import run_movie_ingestion, run_person_ingestion
logger = get_logger(__name__)
async def ingest_movie_task(ctx: dict[str, Any], job_id: str, external_id: str) -> str:
movie_id = await run_movie_ingestion(uuid.UUID(job_id), external_id)
2026-09-04 17:34:03 -05:00
return str(movie_id)
async def ingest_person_task(ctx: dict[str, Any], job_id: str, external_id: str) -> str:
person_id = await run_person_ingestion(uuid.UUID(job_id), external_id)
2026-09-04 17:34:03 -05:00
return str(person_id)