caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

42 lines
1.4 KiB
Python

"""AI panel jobs (MV16, Wave P PM3.5) on the bulk lane (CPU tier 3, never ahead of paid renders). Never raises."""
from __future__ import annotations
import shutil
from typing import Any
from loguru import logger
from app.workers.celery_app import celery_app
AI_TASK = "app.domains.ott_ai.tasks.run_ai_task"
def run(title_id: str, source_language: str, deps: Any = None) -> dict[str, Any]:
from app.domains.film.story8_render import ffmpeg_bin
from app.domains.ott.feeds import api_base
from app.domains.ott.models import OttTitle
from app.models.db.base import get_session
from . import pipeline
with get_session() as session:
title = session.get(OttTitle, title_id)
if title is None:
return {"skipped": True}
chosen = deps or pipeline.Deps(store=pipeline.Store(), ffmpeg=ffmpeg_bin(),
ffprobe=shutil.which("ffprobe") or "ffprobe", api_base=api_base())
return pipeline.run(session, title, source_language, chosen)
@celery_app.task(name=AI_TASK, soft_time_limit=3 * 3600, time_limit=3 * 3600 + 60)
def run_ai_task(title_id: str, source_language: str) -> dict[str, Any]:
try:
return run(title_id, source_language)
except Exception as exc: # noqa: BLE001 - the rows keep their own failures
logger.error(f"ott ai job {title_id} failed: {exc}")
return {"failed": True}
__all__ = ["AI_TASK", "run", "run_ai_task"]