Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gunicorn :: reload from the application itself

I have recently created a version control page from my application to manage the deployment process.

(Yeah, I know, github + hooks are better than rewriting from zero. But we are in Iran and our beloved government has blocked all the ssh connections to outside of the country. :(( )

There is a merge + reload action in the page. the merge is working like the other parts, but the reload part fails without any message. I have added sudo row for kill command and the user of the worker process has enough permission. I even executed the code form django shell and it reloaded the process.

Is there any restriction for receiving signals, such as workers not being able to reload their master?

Here's the related codes:

def command(x):
    return str(Popen(x.split(' '), stdout=PIPE).communicate()[0])

pid = open(PATH + "/logs/gunicorn.pid").readline().strip()
cmd = "sudo kill -HUP %s" % pid
content += command(cmd)
like image 776
Reza Mohammadi Avatar asked Jan 28 '12 12:01

Reza Mohammadi


1 Answers

Guess off the top of my head is that the restart is not working because the process calling the reload is being killed. Maybe try to daemonize a subprocess that exits after calling the reload? Take a look at this post:

spawning process from python

like image 138
berto Avatar answered Oct 13 '22 22:10

berto