Skip to content

Commit ee065e4

Browse files
committed
Add celery routing and update procfile
1 parent 9e2eb75 commit ee065e4

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

Procfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
web: gunicorn --config gunicorn_conf.py docia.wsgi
2-
worker: celery --app docia worker -l INFO --concurrency=2
2+
worker: celery --app docia worker -l INFO -Q celery -n celery@%h --concurrency=2
3+
workerheavycpu: celery --app docia worker -l INFO Q heavy_cpu -n heavy_cpu@%h --concurrency=1
34
postdeploy: python manage.py migrate
4-

docia/file_processing/analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def process(self, job):
4141
document.save(update_fields=["llm_response", "json_error"])
4242

4343

44-
@shared_task
44+
@shared_task(name="docia.analyze_document")
4545
def task_analyze_document(job_id: str):
4646
runner = AnalyzeDocumentJobWorker()
4747
return runner.run(job_id)

docia/file_processing/classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def process(self, job):
4040
document.save(update_fields=["classification", "classification_type"])
4141

4242

43-
@shared_task
43+
@shared_task(name="docia.classify_document")
4444
def task_classify_document(job_id: str):
4545
runner = DocumentClassificationJobWorker()
4646
return runner.run(job_id)

docia/file_processing/text_extraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def process(self, job):
3535
document.save(update_fields=["text", "is_ocr", "nb_mot"])
3636

3737

38-
@shared_task
38+
@shared_task(name="docia.extract_text", queue="heavy_cpu")
3939
def task_extract_text(job_id: str) -> JobStatus:
4040
worker = ExtractTextJobWorker()
4141
return worker.run(job_id)

docia/file_processing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def run(self, job_id: str) -> JobStatus:
5050
def process(self, job): ...
5151

5252

53-
@shared_task
53+
@shared_task(name="docia.finalize_batch")
5454
def task_finalize_batch(job_results: list[JobStatus], batch_id: str) -> JobStatus:
5555
"""
5656
Celery task to finalize a batch text extraction process.

docia/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
logger = logging.getLogger(__name__)
1111

1212

13-
@shared_task
13+
@shared_task(name="docia.add")
1414
def add(x, y):
1515
logger.info("add %s + %s", x, y)
1616
return x + y

0 commit comments

Comments
 (0)