Running a subprocess in uwsgi application
http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html
--close-on-exec is what you need
Comments
-
Maxim almost 2 years
I'm writing a Django application, which needs to perform long async tasks. Initial idea was to start a subprocess from the view that does that job, and to monitor the progress in another views.
The idea works fine when application is started via
manage.py runserver
, but it doesn't when it is run under uwsgi. The child process is started, but after the view returns uwsgi waits for the child process end, which breaks the whole idea.I can see the request details in the uwsgi log (number of bytes generated, etc), but the socket isn't closed, so the browser waits too.
I have seen other alternatives for running async tasks, e.g. celery, but so far I've spent more time trying to configure celery than I've spent for the task. If there's any other way, I'll be happy to hear how you solved it.