Reputation: 12085
I have a RabbitMQ running inside a Docker container using image tag rabbitmq:management
for the management plugin and proper port mapping (5672 and 15672) using the command
$ docker run -d -p 5672:5672 -p 15672:15672 rabbitmq:management
The container starts with the default credentials (guest/guest). The Management UI is accessible on the host machine at http://localhost:15672
in the browser and with the default credentials.
Then, I set up my Celery as the following:
from celery import Celery
celery_app = Celery(
main='background-task',
broker='amqp://guest@localhost:5672//',
backend='mongodb://localhost:27017/tasks',
result_extended=True,
include=['app.tasks']
)
celery_app.conf.task_routes = {
'add': 'add'
}
I can start the worker with the command below, and it works perfectly fine.
$ celery --app app.main:celery_app worker --loglevel=INFO -Q add
For the Flower, it was started with the command:
$ celery --app app.main:celery_app flower --broker_api="http://guest@localhost:15672/api"
Flower starts up fine, and I can access all tabs, except the Broker tab. Whenever I click on it, the UI shows Error 500
, and this error pops up in the log:
[E 240708 17:37:30 broker:31] Unable to get queues: ''
[E 240708 17:37:30 web:1875] Uncaught exception GET /broker (::1)
HTTPServerRequest(protocol='http', host='localhost:5555', method='GET', uri='/broker', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/path/to/project/.venv/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
result = await result
^^^^^^^^^^^^
File "/path/to/project/.venv/lib/python3.11/site-packages/flower/views/broker.py", line 35, in get
queues=queues)
^^^^^^
UnboundLocalError: cannot access local variable 'queues' where it is not associated with a value
What did I miss? How to make Flower show the Broker tab properly?
Upvotes: 0
Views: 51