Revert "Switch to ZK+PG over Redis for Celery queue"

This reverts commit 54215bab6c.
This commit is contained in:
2023-11-05 17:10:46 -05:00
parent b99b4e64b2
commit 3dc1f57de2
4 changed files with 18 additions and 21 deletions

View File

@ -43,23 +43,11 @@ from flask_sqlalchemy import SQLAlchemy
# Create Flask app and set config values
app = flask.Flask(__name__)
# Set up Celery queue
# Default Zookeeper port; not configurable
queue_port = 2181
# Default Zookeeper path, not configurable
queue_path = "/apibroker"
# Join the coordinator hostnames with the queue port, semicolon separated for Celery
queue_hostport_pairs = ";".join([f"{h}:{queue_port}" for h in config["coordinators"]])
app.config["CELERY_BROKER_URL"] = "zookeeper://{}{}".format(
queue_hostport_pairs, queue_path
app.config["CELERY_BROKER_URL"] = "redis://{}:{}{}".format(
config["queue_host"], config["queue_port"], config["queue_path"]
)
app.config["CELERY_RESULT_BACKEND"] = "db+postgresql://{}:{}@{}:{}/{}".format(
config["database_user"],
config["database_password"],
config["database_host"],
config["database_port"],
config["database_name"],
app.config["CELERY_RESULT_BACKEND"] = "redis://{}:{}{}".format(
config["queue_host"], config["queue_port"], config["queue_path"]
)
# Set up Celery queues
@ -111,13 +99,11 @@ app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://{}:{}@{}:{}/{}".format(
config["database_name"],
)
# Set up debugging
if config["debug"]:
app.config["DEBUG"] = True
else:
app.config["DEBUG"] = False
# Set up authentication
if config["auth_enabled"]:
app.config["SECRET_KEY"] = config["auth_secret_key"]