Celery plugin thats adds ability to graceful stop worker
Project description
# celery-graceful-stop
[Celery](http://celeryproject.org) plugin provides ability of graceful worker stopping.
# Problem Production deployment of long running tasks require worker to be stopped gracefully. Unfortunately celery got different behaviour:
Receiving SIGTERM signal by celery results starting Warm shutdown procedure. Due this procedure, inspect and control commands become unavailable.
More than that, all tasks are terminated forcely by the second SIGTERM with the Cold shutdown procedure.
This module provides more consistent approach to this problem, it
overrides SIGTERM receiver to prevent default Warm shutdown and Cold shutdown worker behaviour,
forces inspect and control commands to be working even after SIGTERM signal received.
# Installation & Setup
` pip install git+https://github.com/MnogoByte/celery-graceful-stop.git `
Append your proj/celery.py file containg app instance with the following lines.
`python import celery_graceful_stop celery_graceful_stop.register(app) `
# Settings
CELERY_GRACEFUL_STOP (boolean). Controls graceful stop function. (True by default)
# Using with systemd
Define 1 service per each worker you got (systemd require only one master pid for restart).
Provide /etc/conf.d/celery_<service_name> configuration file for each worker.
Add [celery@.service](systemd/celery@.service) file into your system.
Register your service with systemctl enable celery@<service_name>.
# Limitations
This module disables pool_shrink, pool_grow, autoscale, pool_reload, add_consumer, cancel_consumer control commands after receiving SIGTERM signal. Actually, you’ll does not need to call them when the worker is shutting down, because worker will not starts new tasks.
This module has been tested only with celery 3.1 with pool=prefork.
# Author
[Antonov Mikhail](https://github.com/atin65536)
# License
BSD - 3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file celery-graceful-stop-0.0.1.tar.gz
.
File metadata
- Download URL: celery-graceful-stop-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba98c9cc835101064d8fd438f29848cd0d33ec9eefd4c117ff3fe7a0864647de |
|
MD5 | 4c5616ded4cac336c2d2ed37442c7a8f |
|
BLAKE2b-256 | 99e1803b5cb691f949c721163c97c5f8ef2751e67772321a93ff04904facfd5e |