From ae2ded119fbdab8e37554a06928824547133e9e7 Mon Sep 17 00:00:00 2001 From: xucai Date: Wed, 12 Jun 2024 19:48:28 +0800 Subject: [PATCH 1/2] rename celery_init.py --- application/api/user/routes.py | 2 +- application/api/user/tasks.py | 2 +- application/app.py | 2 +- application/{celery.py => celery_init.py} | 0 tests/test_celery.py | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename application/{celery.py => celery_init.py} (100%) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 511014925..443faddc5 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -229,7 +229,7 @@ def upload_remote(): def task_status(): """Get celery job status.""" task_id = request.args.get("task_id") - from application.celery import celery + from application.celery_init import celery task = celery.AsyncResult(task_id) task_meta = task.info diff --git a/application/api/user/tasks.py b/application/api/user/tasks.py index 4602bf856..862b6dcd6 100644 --- a/application/api/user/tasks.py +++ b/application/api/user/tasks.py @@ -1,5 +1,5 @@ from application.worker import ingest_worker, remote_worker -from application.celery import celery +from application.celery_init import celery @celery.task(bind=True) def ingest(self, directory, formats, name_job, filename, user): diff --git a/application/app.py b/application/app.py index e646ffbee..fe8efd12b 100644 --- a/application/app.py +++ b/application/app.py @@ -1,6 +1,6 @@ import platform import dotenv -from application.celery import celery +from application.celery_init import celery from flask import Flask, request, redirect from application.core.settings import settings from application.api.user.routes import user diff --git a/application/celery.py b/application/celery_init.py similarity index 100% rename from application/celery.py rename to application/celery_init.py diff --git a/tests/test_celery.py b/tests/test_celery.py index f4b224481..8237d1361 100644 --- a/tests/test_celery.py +++ b/tests/test_celery.py @@ -1,6 +1,6 @@ from unittest.mock import patch from application.core.settings import settings -from application.celery import make_celery +from application.celery_init import make_celery @patch('application.celery.Celery') From 1754570057107b2b872bed0a213b7c3d9529c1d6 Mon Sep 17 00:00:00 2001 From: xucai Date: Wed, 19 Jun 2024 16:17:09 +0800 Subject: [PATCH 2/2] rename celery_init.py --- tests/test_celery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_celery.py b/tests/test_celery.py index 8237d1361..f4ec6a03c 100644 --- a/tests/test_celery.py +++ b/tests/test_celery.py @@ -3,7 +3,7 @@ from application.celery_init import make_celery -@patch('application.celery.Celery') +@patch('application.celery_init.Celery') def test_make_celery(mock_celery): # Arrange app_name = 'test_app_name'