Search code examples
gunicornsupervisordsupervised-learning

How to manage supervisord restart gracefully with gunicorn?


I have scenario in which i want gunicorn workers to acknowledge and fulfill ongoing requests before supervisord starts after stopping(restart).

Can anyone help me with this.


Solution

  • Set your Supervisor configuration as autostart and autorestart as true.

    Then kill the gunicorn by

     kill -HUP `cat /tmp/process.pid` 
    

    It will shutdown gracefully hence processing all requests and supervisor will restart it according to the configurations.

    You can also use reload of gunicorn as it sends HUP signal.