From 401ffd0e860ecd72789b7f685998a4dfad088388 Mon Sep 17 00:00:00 2001 From: Arnav Choudhury Date: Sun, 16 Jun 2024 04:25:43 +0530 Subject: [PATCH] Update start-flower in flower to wait until all celery workers are online (#5012) Flower needs to start only after the celery workers come online. Otherwise one will see errors like `inspect method failed` etc --- .../compose/local/django/celery/flower/start | 8 ++++++++ .../compose/production/django/celery/flower/start | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start index b4783d2f0d..cebb62203a 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start @@ -3,6 +3,14 @@ set -o errexit set -o nounset + +until timeout 10 celery -A config.celery_app inspect ping; do + >&2 echo "Celery workers not available" +done + +echo 'Starting flower' + + exec watchfiles --filter python celery.__main__.main \ --args \ "-A config.celery_app -b \"${CELERY_BROKER_URL}\" flower --basic_auth=\"${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}\"" diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start index 4180d6778d..f903a05a26 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start @@ -4,6 +4,14 @@ set -o errexit set -o nounset + +until timeout 10 celery -A config.celery_app inspect ping; do + >&2 echo "Celery workers not available" +done + +echo 'Starting flower' + + exec celery \ -A config.celery_app \ -b "${CELERY_BROKER_URL}" \