1

My service is as below :

[Service]
User=vagrant
Group=vagrant
WorkingDirectory=/home/vagrant/
ExecStart=/usr/bin/celery -A tasks /usr/bin/flower --port=5000 --basic_auth=sun:flower --persistent=true --/var/log/supervisord.log
Restart=on-failure
Type=simple

I have created a simple tasks for testing purposes after creating a REDIS master-slave replication and pointing Celery and flower to Master...

celery.ini for Supervisord

[program:SPSimpleTasks]
directory = /home/vagrant/
command = celery -A tasks worker --loglevel=DEBUG -n SimpleTasks
user=vagrant
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisord.log
stderr_logfile=/var/log/supervisord.log

celery_app.py

from celery import Celery

app = Celery('tasks', backend='redis://:<PASSWORD>@192.168.100.20:6379/0')
#app.config_from_object('celeryconfig')
app.conf.update(
    enable_utc          =   True,
    broker_url          =   'redis://:<PASSWORD>@192.168.100.20:6379/0',
    result_backend      =   'redis://:<PASSWORD>@192.168.100.20:6379/1',
    result_persistent   =   True,
    task_serializer     =   'json',
    result_serializer   =   'json',
    accept_content      =   ['json']
)

Again, the workers are working fine and flower shows the tasks result. But once I restart the service using

sudo service flower restart

Flower loads as its brand new install without any data...

Am I doing something wrong with the broker / backend urls?

Farhan
  • 505
  • 5
  • 16

1 Answers1

2

Well It was an additional change to the configuration in Flower and I changed the approach a bit!

The required config property was db

I updated the service to

/etc/systemd/system/flower.service

[Unit]
Description=Flower Celery Service

[Service]
User=vagrant
Group=vagrant
WorkingDirectory=/home/vagrant/
ExecStart=/usr/bin/flower --/var/log/supervisord.log
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target

/home/vagrant/flowerconfig.py

port        =   5000
broker      =   'redis://:<password>@192.168.100.20:6379/0'
broker_api  =   'redis://:<password>@192.168.100.20:6379/0'
basic_auth  =   ['sun:flower']
persistent  =   True
db          =   '/home/vagrant/flower.db'

After providing the db property, it was all fine. Except for one issue.. the Flower Dashboard was not showing data but the Tasks page was loading the tasks list prior to the refresh!

Learnt from http://flower.readthedocs.io/en/latest/config.html#db

A database file to use if persistent mode is enabled (by default, db=flower)

I've submitted the same as issue / observation in flower -- https://github.com/mher/flower/issues/787

Hope this helps to other facing similar issue!!

Farhan
  • 505
  • 5
  • 16