CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Collections were bare stubs (name only) lazily created the moment a
movie's belongs_to_collection reference was seen. Adds a real
ingest_collection pipeline: TMDb's /collection/{id} for overview and
poster/backdrop artwork, plus ordered CollectionMovie membership --
linking only movies already ingested into Aurora, the same
never-fabricate-a-stub rule movie recommendations already follow.
get_or_create_collection now refreshes name/overview on an existing
stub instead of only creating, guarded so a bare movie-stub call
(overview=None) never clobbers real data a full ingestion already
filled in.
New POST /api/v1/admin/ingest/collection endpoint and
ingest_collection_task; GET /api/v1/collections/{id} needed no changes
since its read path (collection_service.py) already assembled the full
detail shape.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
"""arq worker process entrypoint.
|
|
|
|
Run with: `arq app.workers.worker.WorkerSettings`
|
|
|
|
Workers scale independently of the API (section 1) — run as many worker
|
|
processes/containers as needed; arq's Redis-backed queue coordinates them so
|
|
each job is picked up by exactly one worker.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from arq.connections import RedisSettings
|
|
|
|
from app.core.config import get_settings
|
|
from app.core.logging import configure_logging, get_logger
|
|
from app.workers.tasks import (
|
|
download_artwork_task,
|
|
ingest_collection_task,
|
|
ingest_movie_task,
|
|
ingest_person_task,
|
|
ingest_season_task,
|
|
ingest_series_task,
|
|
)
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
async def startup(ctx: dict) -> None:
|
|
configure_logging()
|
|
logger.info("worker_started")
|
|
|
|
|
|
async def shutdown(ctx: dict) -> None:
|
|
logger.info("worker_stopped")
|
|
|
|
|
|
class WorkerSettings:
|
|
functions = [
|
|
ingest_movie_task,
|
|
ingest_person_task,
|
|
ingest_series_task,
|
|
ingest_season_task,
|
|
ingest_collection_task,
|
|
download_artwork_task,
|
|
]
|
|
on_startup = startup
|
|
on_shutdown = shutdown
|
|
redis_settings = RedisSettings.from_dsn(get_settings().REDIS_URL)
|
|
max_jobs = get_settings().WORKER_CONCURRENCY
|
|
job_timeout = 300
|
|
max_tries = 5
|