celery_worker_healthcheck
HTTP endpoint that counts ready celery workers
The main usecase is configuring this as a Kubernetes readinessProbe.
If a faulty software update is deployed that prevents the worker from starting,
the readinessProbe detects this, and keeps the previously running Pods,
instead of replacing them with the non-functional new Pods.
Usage
Add this registration statement to your codebase, so that it is picked up by the celery worker, e.g. in the module where the celery application is defined.
import celery_worker_healthcheck
celery.signals.worker_init.connect(weak=False)(celery_worker_healthcheck.start)
Then configure the bind address for the healthcheck in your celery configuration:
worker_healthcheck_bind = '127.0.0.1:8001'
This starts an HTTP server in a thread;
on request it counts the number of workers that have notified they are ready
(using the worker_process_init signal to write a pid file).
If the required number of workers are ready, it returns HTTP 200, else 500.
Configuration
These settings can be configured as part of the normal celery configuration:
worker_healthcheck_bindhost:port on which to listen for healthcheck requests (default: None, i.e. healthcheck is disabled)worker_healthcheck_minimumcount of workers that must be ready for the healthcheck to report success (default: 1)worker_healthcheck_directorydirectory in which to store the state files, one per worker (default:'', i.e. the current directory)worker_healthcheck_filenameformat string how to name the state files, must contain one placeholder{}for the pid (default:'.celery.worker.{}')
celery_worker_healthcheck Changes
1.0.0 (2025-03-10)
- Initial release (initial)
Metadata
Release files for celery_worker_healthcheck 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| celery_worker_healthcheck-1.0.0.tar.gz | 4.5 kB | Without provenance | Details for celery_worker_healthcheck-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| celery_worker_healthcheck-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for celery_worker_healthcheck-1.0.0-py3-none-any.whl |
Total release size: 10.5 kB
Release files / celery_worker_healthcheck-1.0.0.tar.gz
| Download URL | celery_worker_healthcheck-1.0.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a0ea1a81a58fd5169605ae13c8155c94ac628ad784da4e7f73f870d140d7020
|
|
BLAKE2b-256 checksum How to use checksums |
00394ff89ea9328ff864557740db26359f8e55a687c24bd2219778c4c2f1e988
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / celery_worker_healthcheck-1.0.0-py3-none-any.whl
| Download URL | celery_worker_healthcheck-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3a9d3c6f468ceb29292e852c409c0cc486b64018f53e3518dec421126e591ce
|
|
BLAKE2b-256 checksum How to use checksums |
e1b86140981f367a3cd10cd61eb59f23a1994b685eef430c2b692b9673ad9ec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for celery_worker_healthcheck 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.