19 lines
629 B
Python
19 lines
629 B
Python
from celery import Celery
|
|
|
|
from app.config import settings
|
|
from app.logging_config import setup_logging
|
|
|
|
# Configure structured JSON logging for Celery workers
|
|
setup_logging(settings.LOG_LEVEL)
|
|
|
|
celery_app = Celery(
|
|
"quiz_tasks",
|
|
broker=settings.REDIS_URL,
|
|
backend=settings.REDIS_URL,
|
|
include=["app.tasks.pdf_tasks", "app.tasks.quiz_tasks"],
|
|
)
|
|
celery_app.conf.task_serializer = "json"
|
|
celery_app.conf.result_serializer = "json"
|
|
celery_app.conf.accept_content = ["json"]
|
|
celery_app.conf.worker_hijack_root_logger = False # Don't override our JSON logging
|
|
celery_app.conf.broker_connection_retry_on_startup = True
|