diff --git a/application/app.py b/application/app.py index 7350c498..348a578c 100644 --- a/application/app.py +++ b/application/app.py @@ -28,6 +28,7 @@ from werkzeug.utils import secure_filename from error import bad_request from worker import ingest_worker +import celeryconfig # os.environ["LANGCHAIN_HANDLER"] = "langchain" @@ -92,8 +93,8 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER = "inputs" app.config['CELERY_BROKER_URL'] = os.getenv("CELERY_BROKER_URL") app.config['CELERY_RESULT_BACKEND'] = os.getenv("CELERY_RESULT_BACKEND") app.config['MONGO_URI'] = os.getenv("MONGO_URI") -celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'], backend=app.config['CELERY_RESULT_BACKEND']) -celery.conf.update(app.config) +celery = Celery() +celery.config_from_object(celeryconfig) mongo = MongoClient(app.config['MONGO_URI']) db = mongo["docsgpt"] vectors_collection = db["vectors"] diff --git a/application/celeryconfig.py b/application/celeryconfig.py new file mode 100644 index 00000000..efa10f07 --- /dev/null +++ b/application/celeryconfig.py @@ -0,0 +1,7 @@ +import os +broker_url = os.getenv("CELERY_BROKER_URL") +result_backend = os.getenv("CELERY_RESULT_BACKEND") + +task_serializer = 'json' +result_serializer = 'json' +accept_content = ['json'] \ No newline at end of file