Monitoring Celery with Flower
Flower is a web-based tool for monitoring and administrating Celery clusters. It provides real-time information about the state of your workers and tasks.
Installation
Flower is a Python package that can be installed via pip.
pip install flower
Running Flower
To start Flower, you use the celery command line interface. You need to point it to your Celery application instance (just like you do for the worker).
Assuming your project structure has a tasks.py or main.py where the Celery app is defined:
celery -A tasks flower
-A tasks: Specifies the application module.flower: The command to start the web server.
By default, Flower starts a web server on port 5555.
Accessing the Dashboard
Open your web browser and navigate to:
http://localhost:5555
Key Features
1. Real-time Monitoring
View task progress and history. You can see which tasks are currently executing, which have succeeded, and which have failed.
2. Worker Status
See the status of all workers in your cluster.
- Online/Offline status
- Load average
- Memory usage
3. Remote Control
Flower allows you to control your workers remotely:
- Restart worker pools.
- Grow/Shrink the worker pool (add or remove concurrent processes).
- Rate Limit: Change the rate limit of a task type on the fly.
- Revoke: Cancel executing tasks.
Production Configuration
Basic Authentication
To protect the dashboard in a production environment, you can enable Basic Auth.
celery -A tasks flower --basic_auth=username:password
See also: Celery Basics