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
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.
50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
"""Compose stage that marks the final MP4 as AI-generated before delivery (MN5).
|
|
|
|
This is the chord callback :mod:`app.workers.pipeline` uses in place of
|
|
``app.workers.tasks.stage_compose_task``. It runs the same compose
|
|
(:func:`app.services.reelforge.stage_compose`) through the same stage runner and
|
|
failure/refund machinery (``StageTask``), then writes the provenance tag into
|
|
the final MP4 (:func:`app.services.provenance.tag_final`) and replaces the
|
|
stored copy. Because tagging happens inside the stage, the job is marked
|
|
complete (and handed to autopublish) only once the file carries the tag; a
|
|
tagging failure fails the stage and follows the normal refund path.
|
|
|
|
The task keeps the leaf name ``stage_compose_task`` so the stage name derived by
|
|
``StageTask`` stays ``compose``. The original task stays registered and
|
|
routable (nothing is removed).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from app.workers.celery_app import celery_app
|
|
from app.workers.context import merge_partials
|
|
from app.workers.tasks import StageTask, _run_stage
|
|
|
|
COMPOSE_TASK_NAME = "app.workers.tasks_provenance.stage_compose_task"
|
|
|
|
|
|
def compose_with_provenance(job_id: str, params: Any, ctx: dict) -> dict:
|
|
"""Compose the reel, then tag and re-store the final MP4."""
|
|
from app.services import provenance
|
|
from app.services.reelforge import stage_compose
|
|
|
|
result = stage_compose(job_id, params, ctx)
|
|
return provenance.tag_final(job_id, dict(result or {}))
|
|
|
|
|
|
@celery_app.task(
|
|
name=COMPOSE_TASK_NAME,
|
|
base=StageTask,
|
|
bind=True,
|
|
soft_time_limit=600,
|
|
time_limit=660,
|
|
)
|
|
def stage_compose_task(self, results: list[dict]) -> dict:
|
|
"""Chord callback: merge avatar + captions partials, compose, then tag."""
|
|
return _run_stage(merge_partials(results), "compose", compose_with_provenance)
|
|
|
|
|
|
__all__ = ["COMPOSE_TASK_NAME", "compose_with_provenance", "stage_compose_task"]
|