Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the number of gunicorn workers?

How can I programmatically retrieve the current number of Gunicorn workers from within a WSGI app running in Gunicorn? I'm using Flask if that makes any difference.

like image 970
Doctor J Avatar asked Mar 15 '23 12:03

Doctor J


1 Answers

From terminal:

ps aux | grep gunicorn | grep -v grep | wc -l

gunicorn could be the app name if that is present in the command (if you're running just one app this example would work fine, else it would show the total amount of workers of all apps)

like image 63
Peter Avatar answered Mar 24 '23 01:03

Peter