Skip to main content

Django command to launch celery worker, beat, flower

Project description

Django command to run celery (worker, beat, flower) with automatically reboot server after changing files

Project Status
CI/CD Latest Release
Quality Coverage
Package PyPI - Version PyPI - Support Python Versions Project PyPI - Downloads
Meta types - Mypy License - MIT code style - Ruff

Benefits of using this cli

  1. The ability to run up to three servers (worker, beat, flower) simultaneously in one terminal, instead of running by default in three different terminals.
  2. Automatic reboot of these servers when your codebase changes

Install

  1. Install package

    pip install celery-starter
    
  2. Add app name to INSTALLED_APPS

    INSTALLED_APPS = [
        'celery_starter',
    ]
    

Command to run the program:

python manage.py runcelery

Arguments can be passed in any order, it doesn't matter.

Optional Arguments:

-h or --help Show help message.
-w <cmd> or --worker <cmd> Full command line to run worker or options that extend the default command line.
-b <cmd> or --beat <cmd> Full command line to run beat or options that extend the default command line.
-f <cmd> or --flower <cmd> Full command line to run flower or options that extend the default command line.
-eb or --exclude_beat Excludes the beat server at startup.
-ef or --exclude_flower Excludes the flower server at startup.
-d or --debug Displays information about successful/unsuccessful completion of processes.

To stopped program pressing the keyboard shortcut CTRL+C

Examples of Commands

default commands:

# worker cmd
# (WARNING) Note that the default pool is solo, because of this, all tasks will be performed sequentially, to get parallelism, install one of the libraries [gevent | eventlet] and redefine the default pool in cmd.
celery -A <CELERY_APP> worker -E -l INFO -P solo

# beat cmd
celery -A <CELERY_APP> beat --pidfile=celerybeat.pid -l INFO

# flower cmd
celery --broker=redis://localhost:6379// flower -A <CELERY_APP> --url_prefix=flower

valid commands:

# redefining the -A and -P parameter and adding a new --broker parameter to the default worker command
python manage.py runcelery -w "-A <CELERY_APP> -P gevent --broker=redis://localhost:6379//"

# complete replacement of the default worker command with the passed command
python manage.py runcelery -w "celery -A <CELERY_APP> worker"

Working with beat and flower commands works in a similar way.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

celery_starter-1.0.8.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

celery_starter-1.0.8-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file celery_starter-1.0.8.tar.gz.

File metadata

  • Download URL: celery_starter-1.0.8.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for celery_starter-1.0.8.tar.gz
Algorithm Hash digest
SHA256 cb23e7535aaa58a4fefe162aa36576d059bc517811a8e5eeecc6eee5ddc9ef42
MD5 61b3bfc0afd760f78547dc62080e9e0f
BLAKE2b-256 828f448f24ba9e14c931c9ac2187c186f98095f471812a5accbdcded47496285

See more details on using hashes here.

File details

Details for the file celery_starter-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for celery_starter-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3cad6ec234daa3f3536a36c4e20cb523b01366d36983515f2f73c167126427fb
MD5 b3ecb19e8abe4b68713111763371faaa
BLAKE2b-256 78f7a833f42c2df44d484edbfd7d4f9669fcb5a2e5d03d10ef83605c3e266d95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page