From d226e9f4e5497948400d6a2878fa0d4be23f0215 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 16 Nov 2023 12:02:57 -0500 Subject: [PATCH] Enable extended Celery results --- api-daemon/pvcapid/flaskapi.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index f1d084d7..a40dd73a 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -56,12 +56,11 @@ from flask_sqlalchemy import SQLAlchemy # Create Flask app and set config values app = flask.Flask(__name__) -app.config["CELERY_BROKER_URL"] = "redis://{}:{}{}".format( - config["queue_host"], config["queue_port"], config["queue_path"] -) -app.config["CELERY_RESULT_BACKEND"] = "redis://{}:{}{}".format( +celery_task_uri = "redis://{}:{}{}".format( config["queue_host"], config["queue_port"], config["queue_path"] ) +app.config["CELERY_BROKER_URL"] = celery_task_uri +app.config["CELERY_RESULT_BACKEND"] = celery_task_uri # Set up Celery queues @@ -132,7 +131,12 @@ api = Api(blueprint) app.register_blueprint(blueprint) # Create celery definition -celery = Celery(app.name, broker=app.config["CELERY_BROKER_URL"]) +celery = Celery( + app.name, + broker=celery_task_uri, + result_backend=celery_task_uri, + result_extended=True, +) celery.conf.update(app.config) #