d05279b410
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 42s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m35s
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m37s
AI Code Review / AI Code Review (pull_request) Failing after 1m38s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m55s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 33s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m42s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m23s
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
- generation_task_repository: add cleanup_stale_pending() method marks status=pending + created_at > timeout as failed with error_message="pending timeout: auto cleanup" - _startup.py: add cleanup_stale_pending_tasks() function with PENDING_TASK_TIMEOUT_MINUTES = 30 constant - cleanup.py: new Celery scheduled task worker.cleanup_stale_pending_tasks - celery_app.py: add beat_schedule, runs every 10 minutes (600s) - entrypoint-worker.sh: add -B flag for embedded celery beat - 6 unit tests for cleanup_stale_pending
33 lines
1.1 KiB
Python
Executable File
33 lines
1.1 KiB
Python
Executable File
from celery import Celery
|
|
from worker_app.core.config import get_settings
|
|
|
|
settings = get_settings()
|
|
celery_app = Celery(settings.worker_name)
|
|
celery_app.conf.broker_url = settings.broker_url
|
|
celery_app.conf.result_backend = settings.result_backend
|
|
celery_app.conf.broker_connection_retry_on_startup = True
|
|
celery_app.conf.imports = (
|
|
"worker_app.tasks.health",
|
|
"worker_app.tasks.ingest",
|
|
"worker_app.tasks.classification",
|
|
"worker_app.tasks.generation",
|
|
"worker_app.tasks.voice_extraction",
|
|
"worker_app.tasks.voice_clone",
|
|
"worker_app.tasks.tts_synthesis",
|
|
"worker_app.tasks.edit_plan_generation",
|
|
"worker_app.tasks.compose_video",
|
|
"worker_app.tasks.batch_download",
|
|
"worker_app.tasks._startup",
|
|
"apps.worker.video_processing.dedup",
|
|
"worker_app.tasks.cleanup",
|
|
)
|
|
|
|
# Celery Beat 定时任务调度
|
|
celery_app.conf.beat_schedule = {
|
|
"cleanup-stale-pending-tasks": {
|
|
"task": "worker.cleanup_stale_pending_tasks",
|
|
"schedule": 600.0, # 每 10 分钟(秒)
|
|
"options": {"expires": 300}, # 5 分钟过期,避免堆积
|
|
},
|
|
}
|