Skip to content

Commit e760dc3

Browse files
committed
remove only redundant make_celery function
1 parent dc670e1 commit e760dc3

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

app/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from apiflask import APIFlask
1010

11-
from app.celery_worker import make_celery, celery
1211
from app.ro_crates.routes import v1_post_bp, v1_get_bp
1312
from app.utils.config import DevelopmentConfig, ProductionConfig, make_celery
1413

app/celery_worker.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,6 @@
55
# Copyright (c) 2025 eScience Lab, The University of Manchester
66

77
from celery import Celery
8-
from flask import Flask
9-
10-
11-
def make_celery(app: Flask = None) -> Celery:
12-
"""
13-
Create and configure a Celery instance using Flask configuration.
14-
15-
:param app: The Flask application. Configuration will be used to initialise Celery.
16-
:return: Celery: A configured Celery instance.
17-
:raises ValueError: If the Flask configuration values are not provided.
18-
"""
19-
if not app:
20-
raise ValueError(
21-
"A Flask application instance must be provided to configure Celery."
22-
)
23-
24-
if "CELERY_RESULT_BACKEND" not in app.config:
25-
raise ValueError(
26-
"Missing configuration: 'CELERY_RESULT_BACKEND' is not defined in the Flask app config."
27-
)
28-
29-
if "CELERY_BROKER_URL" not in app.config:
30-
raise ValueError(
31-
"Missing configuration: 'CELERY_BROKER_URL' is not defined in the Flask app config."
32-
)
33-
34-
celery_instance = Celery(
35-
app.import_name,
36-
backend=app.config["CELERY_RESULT_BACKEND"],
37-
broker=app.config["CELERY_BROKER_URL"],
38-
)
39-
40-
if app:
41-
celery_instance.conf.update(app.config)
42-
43-
return celery_instance
448

459

4610
celery = Celery()

0 commit comments

Comments
 (0)