800f90d8c6
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 2s
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Check push changed paths (push) Successful in 4s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 24s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 26s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 1m15s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 1m37s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 1m58s
CI/CD Pipeline / Validate - Style (push) Successful in 2m13s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m38s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 4m9s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m38s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 2m57s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 4m49s
CI/CD Pipeline / Validate - Security (push) Successful in 8m27s
CI/CD Pipeline / Unit Tests (push) Successful in 8m34s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
"""AI数字人渲染 Celery 异步任务 — #1798."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from app.core.celery_app import celery_app
|
|
from app.dependencies import get_db_session
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@celery_app.task(bind=True, name="ai_avatar_render.execute", max_retries=2)
|
|
def execute_ai_avatar_render(self, job_id: str) -> dict:
|
|
"""执行 AI 数字人渲染管线.
|
|
|
|
进度更新:
|
|
- 0%: 任务开始
|
|
- 20%: 下载对口型视频完成
|
|
- 40%: 滤镜链构建完成
|
|
- 80%: FFmpeg 渲染完成
|
|
- 95%: 上传 OSS 完成
|
|
- 100%: 任务完成
|
|
"""
|
|
logger.info("开始执行渲染任务: %s", job_id)
|
|
self.update_state(state="PROCESSING", meta={"progress": 0, "job_id": job_id})
|
|
|
|
try:
|
|
# 获取数据库 session
|
|
db_gen = get_db_session()
|
|
db = next(db_gen)
|
|
try:
|
|
from app.services.ai_avatar_render_service import AiAvatarRenderService
|
|
|
|
service = AiAvatarRenderService(db)
|
|
service.execute_render(job_id)
|
|
finally:
|
|
try:
|
|
next(db_gen)
|
|
except StopIteration:
|
|
pass
|
|
|
|
return {"status": "completed", "job_id": job_id}
|
|
|
|
except Exception as exc:
|
|
logger.exception("渲染任务执行异常 [%s]: %s", job_id, exc)
|
|
self.update_state(state="FAILED", meta={"progress": 0, "error": str(exc)})
|
|
raise
|