Hi there,

I think it is handy to have a way to check if the spooler is running from the python module. Calling uwsgi.spooler_pid() will return the pid of the spooler otherwise 0. Also document its usage by using it in uwsgicc.

thanks,
riccardo
diff -r dc72b2d2c2f8 plugins/python/uwsgi_pymodule.c
--- a/plugins/python/uwsgi_pymodule.c	Tue Jun 28 06:46:43 2011 +0200
+++ b/plugins/python/uwsgi_pymodule.c	Tue Jun 28 12:03:29 2011 +0200
@@ -1251,6 +1251,10 @@
 	Py_INCREF(Py_None);
 	return Py_None;
 }
+
+PyObject *py_uwsgi_spooler_pid(PyObject * self, PyObject * args) {
+	return PyInt_FromLong(uwsgi.shared->spooler_pid ? uwsgi.shared->spooler_pid : 0);
+}
 #endif
 
 PyObject *py_uwsgi_send_multi_message(PyObject * self, PyObject * args) {
@@ -2262,6 +2266,7 @@
 #endif
 	{"set_spooler_frequency", py_uwsgi_spooler_freq, METH_VARARGS, ""},
 	{"spooler_jobs", py_uwsgi_spooler_jobs, METH_VARARGS, ""},
+	{"spooler_pid", py_uwsgi_spooler_pid, METH_VARARGS, ""},
 	{NULL, NULL},
 };
 #endif
diff -r dc72b2d2c2f8 uwsgicc/templates/index.html
--- a/uwsgicc/templates/index.html	Tue Jun 28 06:46:43 2011 +0200
+++ b/uwsgicc/templates/index.html	Tue Jun 28 12:03:29 2011 +0200
@@ -204,6 +204,9 @@
 <b>cores:</b> {{ uwsgi.cores }}<br/>
 <b>masterpid:</b> {{uwsgi.masterpid()}}<br/>
 <b>cluster:</b> {{uwsgi.cluster()}}<br/>
+{% if uwsgi.opt['spooler'] %}
+<b>spooler pid:</b> {{uwsgi.spooler_pid()}}<br/>
+{% endif %}
 
     <div class="anchor">
     <a href="#top">back to top</a>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to