Convert Figma logo to code with AI

mher logoflower

Real-time monitor and web admin for Celery distributed task queue

6,518
1,097
6,518
149

Top Related Projects

25,320

Distributed Task Queue (development branch)

Machinery is an asynchronous task queue/job queue based on distributed message passing.

9,995

Simple job queues for Python

18,034

Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in.

38,365

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

18,072

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.

Quick Overview

Flower is a friendly Celery distributed task queue for Python. It provides a real-time web-based monitoring tool for Celery clusters, allowing users to manage their workers, view task progress, and monitor system resources. Flower simplifies the process of managing and monitoring distributed task queues in Python applications.

Pros

  • User-friendly web interface for monitoring Celery tasks and workers
  • Real-time updates and statistics on task execution and worker status
  • Ability to remotely control workers and tasks (start, stop, restart)
  • Supports authentication and SSL for secure access

Cons

  • Limited customization options for the web interface
  • May introduce additional overhead in large-scale deployments
  • Requires separate installation and configuration alongside Celery
  • Documentation could be more comprehensive for advanced use cases

Code Examples

  1. Basic Flower setup with Celery:
from celery import Celery
from flower.utils.app import FlowerApp

app = Celery('tasks', broker='redis://localhost:6379')

if __name__ == '__main__':
    FlowerApp(app=app).run()
  1. Configuring Flower with authentication:
from flower.utils.app import FlowerApp

app = Celery('tasks', broker='redis://localhost:6379')

if __name__ == '__main__':
    FlowerApp(
        app=app,
        auth=['user:password'],
        basic_auth=['user:password']
    ).run()
  1. Using Flower API to get worker status:
import requests

response = requests.get('http://localhost:5555/api/workers')
workers = response.json()

for worker_name, worker_info in workers.items():
    print(f"Worker: {worker_name}")
    print(f"Status: {worker_info['status']}")
    print(f"Active tasks: {worker_info['active']}")

Getting Started

  1. Install Flower:

    pip install flower
    
  2. Start Flower alongside your Celery application:

    celery -A your_app flower
    
  3. Access the Flower web interface: Open a web browser and navigate to http://localhost:5555

  4. (Optional) Configure authentication in your Celery app:

    app.conf.flower_basic_auth = ['username:password']
    

Competitor Comparisons

25,320

Distributed Task Queue (development branch)

Pros of Celery

  • More mature and widely adopted project with extensive documentation
  • Supports a broader range of message brokers and result backends
  • Offers more advanced features like task routing and periodic tasks

Cons of Celery

  • Steeper learning curve due to its complexity
  • Heavier resource usage, especially for smaller projects
  • Configuration can be more challenging and verbose

Code Comparison

Celery task definition:

from celery import Celery

app = Celery('tasks', broker='redis://localhost:6379')

@app.task
def add(x, y):
    return x + y

Flower doesn't have a direct code comparison as it's a monitoring tool for Celery, not a task queue itself. However, here's an example of how to start Flower:

from flower.command import FlowerCommand

FlowerCommand().execute_from_commandline()

Summary

Celery is a robust, feature-rich distributed task queue, while Flower is a web-based monitoring tool specifically designed for Celery. They serve different purposes but are often used together in Celery-based projects. Celery offers more functionality and flexibility, but may be overkill for simpler use cases. Flower provides valuable insights into Celery task execution and worker status, enhancing the overall Celery ecosystem.

Machinery is an asynchronous task queue/job queue based on distributed message passing.

Pros of Machinery

  • Built specifically for Go, offering native language integration
  • Supports multiple backends (Redis, AMQP, MongoDB) for task storage
  • Includes a web UI for task monitoring and management

Cons of Machinery

  • Less extensive documentation compared to Flower
  • Fewer built-in features for task routing and prioritization
  • Limited support for distributed task execution across multiple workers

Code Comparison

Machinery (Go):

server := machinery.NewServer(cnf)
task := tasks.NewSignature("add", []tasks.Arg{
    {Type: "int64", Value: 1},
    {Type: "int64", Value: 1},
})
asyncResult, err := server.SendTask(task)

Flower (Python):

from tasks import add
result = add.delay(1, 1)
result.get()

Machinery focuses on Go-specific syntax and configuration, while Flower leverages Python's simplicity and integration with Celery. Machinery requires more setup code, but offers greater flexibility in backend choices. Flower's code is more concise due to Python's dynamic nature and Celery's abstractions.

Both projects aim to simplify distributed task processing, but cater to different language ecosystems and use cases. Machinery is ideal for Go-centric projects, while Flower excels in Python environments, particularly those already using Celery.

9,995

Simple job queues for Python

Pros of RQ

  • Simpler and more lightweight, focusing solely on job queuing
  • Better integration with Redis, leveraging its features for queue management
  • More mature project with a larger community and ecosystem

Cons of RQ

  • Less feature-rich compared to Flower's task distribution capabilities
  • Limited to Redis as the only backend option
  • Lacks built-in periodic task scheduling (requires separate libraries)

Code Comparison

RQ:

from redis import Redis
from rq import Queue

q = Queue(connection=Redis())
job = q.enqueue(my_function, args=(1, 2), kwargs={'c': 3})

Flower:

from flower import Flower

app = Flower('redis://localhost:6379/0')

@app.task
def my_task(a, b, c=0):
    return a + b + c

result = my_task.delay(1, 2, c=3)

Both libraries offer straightforward ways to enqueue tasks, but Flower provides a more Celery-like API with decorators and task definitions. RQ's approach is more explicit in queue creation and job enqueuing.

18,034

Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in.

Pros of Luigi

  • More mature and widely adopted project with extensive documentation
  • Supports a broader range of data processing tasks and integrations
  • Offers a web-based visualization interface for task dependencies

Cons of Luigi

  • Steeper learning curve due to its complexity and extensive features
  • Requires more boilerplate code to set up tasks and workflows
  • Heavier resource usage, especially for smaller projects

Code Comparison

Luigi:

import luigi

class MyTask(luigi.Task):
    def requires(self):
        return SomeOtherTask()

    def run(self):
        # Task logic here

Flower:

from flower import task

@task
def my_task():
    # Task logic here

Summary

Luigi is a more comprehensive workflow management tool suitable for complex data processing pipelines, while Flower focuses on simplicity and ease of use for distributed task processing. Luigi offers more features and integrations but requires more setup, whereas Flower provides a more straightforward API for quick implementation of distributed tasks. Choose Luigi for large-scale data workflows with complex dependencies, and Flower for simpler distributed task processing needs.

38,365

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

Pros of Airflow

  • More comprehensive workflow management system with advanced scheduling and dependency management
  • Larger community and ecosystem with extensive plugins and integrations
  • Better suited for complex, enterprise-level data pipelines and ETL processes

Cons of Airflow

  • Steeper learning curve and more complex setup compared to Flower
  • Heavier resource requirements and potential overkill for simpler task monitoring needs
  • Less focused on real-time task monitoring and visualization

Code Comparison

Flower (task definition):

@app.task
def add(x, y):
    return x + y

Airflow (DAG definition):

from airflow import DAG
from airflow.operators.python_operator import PythonOperator

def add(x, y):
    return x + y

dag = DAG('example_dag', schedule_interval='@daily')
task = PythonOperator(task_id='add_task', python_callable=add, dag=dag)

Flower is more lightweight and focused on monitoring Celery tasks, while Airflow provides a complete workflow management solution with more complex DAG definitions and scheduling capabilities.

18,072

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.

Pros of Prefect

  • More comprehensive workflow management system with advanced features like scheduling, monitoring, and distributed execution
  • Larger and more active community, with frequent updates and extensive documentation
  • Better suited for complex data pipelines and production-grade workflows

Cons of Prefect

  • Steeper learning curve due to its more extensive feature set
  • Heavier and more resource-intensive compared to Flower's lightweight design
  • May be overkill for simple task queuing needs

Code Comparison

Flower task definition:

@app.task
def add(x, y):
    return x + y

Prefect task definition:

from prefect import task

@task
def add(x, y):
    return x + y

Summary

Prefect is a more robust workflow management system suitable for complex data pipelines, while Flower is a simpler, lightweight task queue focused on distributed task execution. Prefect offers advanced features and better scalability but comes with a steeper learning curve. Flower is easier to set up and use for basic task queuing needs but may lack some advanced features required for complex workflows.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Flower

.. image:: https://img.shields.io/pypi/dm/flower.svg :target: https://pypistats.org/packages/flower :alt: PyPI - Downloads .. image:: https://img.shields.io/docker/pulls/mher/flower.svg :target: https://hub.docker.com/r/mher/flower :alt: Docker Pulls .. image:: https://github.com/mher/flower/workflows/Build/badge.svg :target: https://github.com/mher/flower/actions .. image:: https://img.shields.io/pypi/v/flower.svg :target: https://pypi.python.org/pypi/flower

Flower is an open-source web application for monitoring and managing Celery clusters. It provides real-time information about the status of Celery workers and tasks.

Features

  • Real-time monitoring using Celery Events
    • View task progress and history
    • View task details (arguments, start time, runtime, and more)
  • Remote Control
    • View worker status and statistics
    • Shutdown and restart worker instances
    • Control worker pool size and autoscale settings
    • View and modify the queues a worker instance consumes from
    • View currently running tasks
    • View scheduled tasks (ETA/countdown)
    • View reserved and revoked tasks
    • Apply time and rate limits
    • Revoke or terminate tasks
  • Broker monitoring
    • View statistics for all Celery queues
  • HTTP Basic Auth, Google, Github, Gitlab and Okta OAuth
  • Prometheus integration
  • API

Installation

Installing flower with pip <http://www.pip-installer.org/>_ is simple ::

$ pip install flower

The development version can be installed from Github ::

$ pip install https://github.com/mher/flower/zipball/master#egg=flower

Usage

To run Flower, you need to provide the broker URL ::

$ celery --broker=amqp://guest:guest@localhost:5672// flower

Or use the configuration of celery application <https://docs.celeryq.dev/en/stable/userguide/application.html>_ ::

$ celery -A tasks.app flower

By default, flower runs on port 5555, which can be modified with the port option ::

$ celery -A tasks.app flower --port=5001

You can also run Flower using the docker image ::

$ docker run -v examples:/data -p 5555:5555 mher/flower celery --app=tasks.app flower

In this example, Flower is using the tasks.app defined in the examples/tasks.py <https://github.com/mher/flower/blob/master/examples/tasks.py>_ file

API

Flower API enables to manage the cluster via HTTP REST API.

For example you can restart worker's pool by: ::

$ curl -X POST http://localhost:5555/api/worker/pool/restart/myworker

Or call a task by: ::

$ curl -X POST -d '{"args":[1,2]}' http://localhost:5555/api/task/async-apply/tasks.add

Or terminate executing task by: ::

$ curl -X POST -d 'terminate=True' http://localhost:5555/api/task/revoke/8a4da87b-e12b-4547-b89a-e92e4d1f8efd

For more info checkout API Reference_

.. _API Reference: https://flower.readthedocs.io/en/latest/api.html

Documentation

Documentation is available at Read the Docs_

.. _Read the Docs: https://flower.readthedocs.io

License

Flower is licensed under BSD 3-Clause License. See the License_ file for the full license text.

.. _License: https://github.com/mher/flower/blob/master/LICENSE