baldur.adapters.gunicorn — Gunicorn Lifecycle Hooks
Hook callables suitable for gunicorn -c configuration so Baldur's
GracefulShutdownCoordinator fires registered handlers (Audit WAL flush,
leader-election release, bulkhead drain, etc.) when the worker receives
SIGTERM / SIGQUIT.
gunicorn
Gunicorn integration for baldur.
Provides hook callables suitable for gunicorn -c configuration so that
baldur's :class:GracefulShutdownCoordinator fires registered handlers
(Audit WAL flush, leader-election release, bulkhead drain, etc.) when the
worker receives SIGTERM/SIGQUIT.
Usage A — re-export in your gunicorn.conf.py::
# gunicorn.conf.py
from baldur.adapters.gunicorn.hooks import (
post_worker_init, worker_int, worker_exit,
)
Usage B — point -c directly at the shipped hooks module::
gunicorn -c "$(python -c 'from baldur.adapters.gunicorn import hooks; print(hooks.__file__)')" wsgi:app
Without one of these wiring patterns, baldur's registered shutdown
handlers will NOT fire on SIGTERM in a gunicorn deployment — gunicorn's
worker-level signal handler invokes worker_int only when the user has
configured one.
Status: Public
post_worker_init
post_worker_init(worker: Any) -> None
Gunicorn post_worker_init hook.
See module docstring for responsibilities.
worker_exit
worker_exit(worker: Any, server: Any) -> None
Gunicorn worker_exit hook (worker about to terminate).
See module docstring for responsibilities.
worker_int
worker_int(worker: Any) -> None
Gunicorn worker_int hook (SIGINT/SIGQUIT forwarded to worker).
See module docstring for responsibilities.