cmvr-visual/backend/app/services/orchestration/batch_holds.py
zhanghao 88cf14d794 feat: consolidate story studio and editable automatic production
Restructure backend and frontend modules; add story, library, and editor schema migrations.

Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews.

Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
2026-11-14 14:07:26 +08:00

24 lines
682 B
Python

"""批次暂停/等待规则与创建流程分离,避免工作流和批次服务反向依赖。"""
from app.models import Batch
def member_holds(holds, b, waiting):
holds = set(holds or []) | set(b.hold_reasons or [])
if b.desired_state == "pause":
holds.add("batch_pause")
else:
holds.discard("batch_pause")
if waiting:
holds.add("batch_wait")
else:
holds.discard("batch_wait")
return holds
async def run_member_holds(s, r):
b = await s.get(Batch, r.batch_id)
if b is None or b.deleted_at is not None:
return set(r.hold_reasons or []) | {"batch_wait"}
return member_holds(r.hold_reasons, b, False)