Skip to content

Commit

Permalink
Test getting worker pid and startup/shutdown hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Jul 30, 2024
1 parent ff77f67 commit 08dec1d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions config/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
import logging
from activator.activator import cleanup_worker


def pre_fork(server, worker):
logging.warning("Worker %s about to be forked.", worker.pid)


def post_fork(server, worker):
logging.warning("Worker %s has been forked.", worker.pid)


def post_worker_init(worker):
logging.warning("Worker %s has a WSGI application [post_worker_init].", worker.pid)


def worker_exit(server, worker):
logging.warning("Worker %s has been exited [worker_exit].", worker.pid)
cleanup_worker()


def worker_int(worker):
logging.warning("Worker %s exited on SIGINT or SIGQUIT.", worker.pid)


def worker_abort(worker):
logging.warning("Worker %s received SIGABRT.", worker.pid)


def child_exit(server, worker):
logging.warning("Worker %s has been exited [child_exit].", worker.pid)


def nworkers_changed(server, new_value, old_value):
logging.warning("Worker count has changed from %s to %s.", old_value, new_value)

0 comments on commit 08dec1d

Please sign in to comment.