Added first working version of the code. Processes
PDF files, no upload yet.
This commit is contained in:
+16
-3
@@ -1,9 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from celery import Celery
|
||||
from .config import settings
|
||||
from app.config import settings
|
||||
|
||||
# Import the shared Celery instance
|
||||
from app.celery_app import celery
|
||||
|
||||
# Ensure tasks are loaded
|
||||
from app import tasks # <— This imports app/tasks.py so Celery can register 'process_document'
|
||||
|
||||
# **Ensure all tasks are imported before Celery starts**
|
||||
from app.tasks.upload_to_s3 import upload_to_s3
|
||||
from app.tasks.process_with_textract import process_with_textract
|
||||
from app.tasks.refine_text_with_gpt import refine_text_with_gpt
|
||||
from app.tasks.extract_metadata_with_gpt import extract_metadata_with_gpt
|
||||
from app.tasks.embed_metadata_into_pdf import embed_metadata_into_pdf
|
||||
|
||||
|
||||
celery = Celery("document_processor", broker=settings.redis_url, backend=settings.redis_url)
|
||||
|
||||
celery.conf.task_routes = {
|
||||
"app.tasks.*": {"queue": "default"},
|
||||
@@ -12,3 +24,4 @@ celery.conf.task_routes = {
|
||||
@celery.task
|
||||
def test_task():
|
||||
return "Celery is working!"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user