https://github.com/friskes/celery-starter
Django command to run celery (worker, beat, flower) with automatically reboot server after changing files
https://github.com/friskes/celery-starter
autoreload celery celery-beat celery-flower celery-worker django linux python windows
Last synced: 4 months ago
JSON representation
Django command to run celery (worker, beat, flower) with automatically reboot server after changing files
- Host: GitHub
- URL: https://github.com/friskes/celery-starter
- Owner: Friskes
- License: mit
- Created: 2023-07-13T14:37:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-30T11:50:58.000Z (8 months ago)
- Last Synced: 2025-03-18T13:32:21.552Z (4 months ago)
- Topics: autoreload, celery, celery-beat, celery-flower, celery-worker, django, linux, python, windows
- Language: Python
- Homepage:
- Size: 66.4 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## Django command to run `celery (worker, beat, flower)` with automatically reboot server after changing files
| Project | | Status |
|-----------|:----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CI/CD | | [](https://github.com/Friskes/celery-starter/actions/workflows/publish-to-pypi.yml) |
| Quality | | [](https://codecov.io/github/Friskes/celery-starter) |
| Package | | [](https://badge.fury.io/py/celery-starter)   |
| Meta | | [](https://github.com/python/mypy) [](https://spdx.org/licenses/) [](https://github.com/astral-sh/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
```bash
pip install celery-starter
```2. Add app name to `INSTALLED_APPS`
```python
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 ` or `--worker ` Full command line to run worker or options that extend the default command line.
`-b ` or `--beat ` Full command line to run beat or options that extend the default command line.
`-f ` or `--flower ` 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:```shell
# 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 worker -E -l INFO -P solo# beat cmd
celery -A beat --pidfile=celerybeat.pid -l INFO# flower cmd
celery --broker=redis://localhost:6379// flower -A --url_prefix=flower
```> valid commands:
```shell
# redefining the -A and -P parameter
# and adding a new --broker parameter to the default worker command
python manage.py runcelery -w "-A -P gevent --broker=redis://localhost:6379//"# complete replacement of the default worker command with the passed command
python manage.py runcelery -w "celery -A worker"
```#### Working with beat and flower commands works in a similar way.
## Contributing
We would love you to contribute to `celery-starter`, pull requests are very welcome! Please see [CONTRIBUTING.md](https://github.com/Friskes/celery-starter/blob/main/CONTRIBUTING.md) for more information.