37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from celery import Celery
|
|
from app.config import settings
|
|
|
|
celery_app = Celery(
|
|
"schaefflerautomat",
|
|
broker=settings.redis_url,
|
|
backend=settings.redis_url,
|
|
include=["app.tasks.step_tasks", "app.tasks.ai_tasks", "app.tasks.flamenco_tasks"],
|
|
)
|
|
|
|
celery_app.conf.update(
|
|
task_serializer="json",
|
|
result_serializer="json",
|
|
accept_content=["json"],
|
|
timezone="UTC",
|
|
enable_utc=True,
|
|
task_routes={
|
|
"app.tasks.step_tasks.*": {"queue": "step_processing"},
|
|
"app.tasks.ai_tasks.*": {"queue": "ai_validation"},
|
|
"app.tasks.flamenco_tasks.*": {"queue": "step_processing"},
|
|
},
|
|
beat_schedule={
|
|
"poll-flamenco-jobs": {
|
|
"task": "app.tasks.flamenco_tasks.poll_flamenco_jobs",
|
|
"schedule": 10.0, # every 10 seconds
|
|
# Discard if not consumed before the next run; prevents queue build-up
|
|
# when workers are busy with long-running STEP/render tasks.
|
|
"options": {"expires": 9},
|
|
},
|
|
"check-stalled-renders": {
|
|
"task": "app.tasks.flamenco_tasks.check_stalled_renders",
|
|
"schedule": 300.0, # every 5 minutes
|
|
"options": {"expires": 290},
|
|
},
|
|
},
|
|
)
|