Implement async processing with Celery, Redis, and queue-based email notifications
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Celery application for async transcription jobs.
|
||||
"""
|
||||
|
||||
import os
|
||||
from celery import Celery
|
||||
|
||||
broker_url = os.getenv("CELERY_BROKER_URL", "redis://redis:6379/0")
|
||||
result_backend = os.getenv("CELERY_RESULT_BACKEND", "redis://redis:6379/0")
|
||||
|
||||
celery_app = Celery(
|
||||
"scraibe",
|
||||
broker=broker_url,
|
||||
backend=result_backend,
|
||||
)
|
||||
|
||||
celery_app.conf.update(
|
||||
task_routes={
|
||||
"scraibe.tasks.process_transcription_task": {"queue": "transcription"},
|
||||
},
|
||||
task_serializer="json",
|
||||
result_serializer="json",
|
||||
accept_content=["json"],
|
||||
timezone="UTC",
|
||||
enable_utc=True,
|
||||
)
|
||||
|
||||
celery_app.autodiscover_tasks(["scraibe.tasks"])
|
||||
Reference in New Issue
Block a user