From 2441da427ca66124b762da98adf5a6f966d40a67 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Thu, 4 Nov 2021 17:44:02 -0400 Subject: Work around celery relpath bug for schedule file Signed-off-by: Sawyer Bergeron Change-Id: I9c512479f559b9b6f18f8428a914acdbad129dfd Signed-off-by: Sawyer Bergeron --- src/laas_dashboard/celery.py | 1 + src/laas_dashboard/settings.py | 4 ++-- worker/init.sh | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/laas_dashboard/celery.py b/src/laas_dashboard/celery.py index 65b9211..362bbdb 100644 --- a/src/laas_dashboard/celery.py +++ b/src/laas_dashboard/celery.py @@ -23,6 +23,7 @@ app = Celery('laas_dashboard') # pickle the object when using Windows. app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) +app.config_from_object('django.conf:settings', namespace='CELERY') @app.task(bind=True) diff --git a/src/laas_dashboard/settings.py b/src/laas_dashboard/settings.py index f253fa0..7e27c8d 100644 --- a/src/laas_dashboard/settings.py +++ b/src/laas_dashboard/settings.py @@ -217,9 +217,9 @@ RABBITMQ_URL = 'rabbitmq' RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER'] RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS'] -BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' +CELERY_BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' -CELERYBEAT_SCHEDULE = { +CELERY_BEAT_SCHEDULE = { 'booking_poll': { 'task': 'dashboard.tasks.booking_poll', 'schedule': timedelta(minutes=1) diff --git a/worker/init.sh b/worker/init.sh index 27cee33..d657c3c 100755 --- a/worker/init.sh +++ b/worker/init.sh @@ -7,4 +7,5 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -celery -A laas_dashboard worker -l info -B --schedule=~/celerybeat-schedule + +celery -A laas_dashboard worker -l info -B --schedule=/home/celery/schedule -- cgit 1.2.3-korg