I like the atexit module approach. atexit was not working when I used the
stdlib version and I'm not sure why that is the case (though it may not be
important since the uwsgi version works). I have a code snippet at the
bottom. But, using uwsgi.atexit works. I notice, though, it is calling
this for the each worker, and not the master. Is there a way to run
something from the master process?
def goodbye():
print "Goodbye from worker %d" % uwsgi.worker_id()
import atexit
atexit.register(goodbye)
and I start the server using
uwsgi --import app.customers_app -s :3939 -M --enable-threads -p 2
On Thu, Apr 25, 2013 at 9:58 AM, Roberto De Ioris <[email protected]> wrote:
>
> > My server is using threads and so sending a -INT or -QUIT doesn't
> > gracefully stop everything.
>
> For which os ?
>
> On platforms implementing thread cancellation (Linux and FreeBSD works
> well) you have gracefully reload/stop even in multithreading mode.
>
> >
> > Is there a standard way to run code when uwsgi is stopping? Is there a
> > decorator I'm missing, or a standard function I can add that I'm not
> > finding in the docs?
> >
>
> it depends on the language you are using. Python atexit module is a common
> approach, while uwsgi.atexit is language independent (not implemented
> everywhere but can be fixed fast).
>
> --
> Roberto De Ioris
> http://unbit.it
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
--
Charles Law Software Developer
Watch how we make online advertising simple: http://bit.ly/Ent_vid
www.openx.com <http://www.openx.org/> | follow us on:
Twitter<http://twitter.com/openx>
Facebook <http://www.facebook.com/OpenX>
LinkedIn<http://www.linkedin.com/company/openx/products>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi