PDF-Assit_RAG / backend /app /celery_app.py
Param20h's picture
deploy: pure backend API with keywords fix
7c46845 unverified
Raw
History Blame Contribute Delete
557 Bytes
import os
from celery import Celery
# Initialize the Celery application instance
celery_app = Celery(
"worker",
broker=os.getenv("CELERY_BROKER_URL", "redis://localhost:6379/0"),
backend=os.getenv("CELERY_RESULT_BACKEND", "redis://localhost:6379/0")
)
# Optional configuration updates for reliable serialization
celery_app.conf.update(
task_serializer="json",
accept_content=["json"],
result_serializer="json",
)
# Tell Celery to discover background tasks dynamically to break circular loops
celery_app.autodiscover_tasks(["app"])