This commit is contained in:
benoitc 2010-03-10 21:04:26 +01:00
parent a10ca702e9
commit 85ec7b3ebc
4 changed files with 30 additions and 17 deletions

View File

@ -66,16 +66,12 @@ group = None # Change process group to group
proc_name = None # Change the process name proc_name = None # Change the process name
tmp_upload_dir = None # Set path used to store temporary uploads tmp_upload_dir = None # Set path used to store temporary uploads
def after_fork(server, worker): after_fork=lambda server, worker: server.log.info(
fmt = "worker=%s spawned pid=%s" "Worker spawned (pid: %s)" % worker.pid),
server.log.info(fmt % (worker.id, worker.pid))
def before_fork(server, worker): before_fork=lambda server, worker: True,
fmt = "worker=%s spawning"
server.log.info(fmt % worker.id)
def before_exec(server): before_exec=lambda server: server.log.info("Forked child, reexecuting"
serer.log.info("Forked child, reexecuting.")
</pre> </pre>
</div> </div>
<div class="section" id="parameter-descriptions"> <div class="section" id="parameter-descriptions">

View File

@ -127,7 +127,7 @@ exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP
<a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/supervisor.conf">simple configuration</a> is:</p> <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/supervisor.conf">simple configuration</a> is:</p>
<pre class="literal-block"> <pre class="literal-block">
[program:gunicorn] [program:gunicorn]
command=/usr/local/bin/gunicorn main:application -C /path/to/project/gunicorn.conf.py command=/usr/local/bin/gunicorn main:application -c /path/to/project/gunicorn.conf.py
directory=/path/to/project directory=/path/to/project
user=nobody user=nobody
autostart=true autostart=true

View File

@ -50,6 +50,20 @@
<div class="document" id="news"> <div class="document" id="news">
<h1 class="title">News</h1> <h1 class="title">News</h1>
<div class="section" id="id1"> <div class="section" id="id1">
<h1>0.6.4 / 2010-03-08</h1>
<ul class="simple">
<li>Use cStringIO when it's possible (use less CPU and faster)</li>
<li>Fix worker freeze when a remote connexion close unexpectedly.</li>
</ul>
</div>
<div class="section" id="id2">
<h1>0.6.3 / 2010-03-07</h1>
<ul class="simple">
<li>Make HTTP parsing faster.</li>
<li>Some fixes (see <a class="reference external" href="http://github.com/benoitc/gunicorn/commits/master">logs</a>)</li>
</ul>
</div>
<div class="section" id="id3">
<h1>0.6.2 / 2010-03-01</h1> <h1>0.6.2 / 2010-03-01</h1>
<ul class="simple"> <ul class="simple">
<li>Added support for chunked response.</li> <li>Added support for chunked response.</li>
@ -59,7 +73,7 @@
<li>Workers are now murdered by age (the older is killed the first).</li> <li>Workers are now murdered by age (the older is killed the first).</li>
</ul> </ul>
</div> </div>
<div class="section" id="id2"> <div class="section" id="id4">
<h1>0.6.1 / 2010-02-24</h1> <h1>0.6.1 / 2010-02-24</h1>
<ul class="simple"> <ul class="simple">
<li>Added gunicorn config file support for django admin command</li> <li>Added gunicorn config file support for django admin command</li>
@ -67,21 +81,21 @@
<li>Removed TTIN/TTOU from workers which blocked other signals.</li> <li>Removed TTIN/TTOU from workers which blocked other signals.</li>
</ul> </ul>
</div> </div>
<div class="section" id="id3"> <div class="section" id="id5">
<h1>0.6 / 2010-02-22</h1> <h1>0.6 / 2010-02-22</h1>
<ul class="simple"> <ul class="simple">
<li>Added setproctitle</li> <li>Added setproctitle</li>
<li>Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.</li> <li>Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.</li>
</ul> </ul>
</div> </div>
<div class="section" id="id4"> <div class="section" id="id6">
<h1>0.5.1 / 2010-02-22</h1> <h1>0.5.1 / 2010-02-22</h1>
<ul class="simple"> <ul class="simple">
<li>Fix umask</li> <li>Fix umask</li>
<li>Added debian packaging</li> <li>Added debian packaging</li>
</ul> </ul>
</div> </div>
<div class="section" id="id5"> <div class="section" id="id7">
<h1>0.5 / 2010-02-20</h1> <h1>0.5 / 2010-02-20</h1>
<ul class="simple"> <ul class="simple">
<li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li> <li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li>

View File

@ -100,7 +100,8 @@ class Arbiter(object):
return return
pid = self.valid_pidfile(path) pid = self.valid_pidfile(path)
if pid: if pid:
if self.pidfile and path == self.pidfile and pid == os.getpid(): if self._pidfile is not None and path == self._pidfile and \
pid == os.getpid():
return path return path
raise RuntimeError("Already running on PID %s " \ raise RuntimeError("Already running on PID %s " \
"(or pid file '%s' is stale)" % (os.getpid(), path)) "(or pid file '%s' is stale)" % (os.getpid(), path))
@ -120,8 +121,10 @@ class Arbiter(object):
""" delete pidfile""" """ delete pidfile"""
try: try:
with open(path, "r") as f: with open(path, "r") as f:
if int(f.read() or 0) == self.pid: pid = int(f.read() or 0)
os.unlink(f)
if pid == self.pid:
os.unlink(path)
except: except:
pass pass