-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to run a system process asynchronously? #2
Comments
web.by fires up a thread; I've done it by using an external worker. |
You probably want subprocess. |
or celery |
The better way to handle this is using a message queue. You push a job onto a queue and a worker picks it up and process it. Check out RabbitMQ, pyres, gearman, bealstalkd etc. |
+1 for yashh |
you can find an example at http://brianglass.wordpress.com/2009/11/29/asynchronous-shell-commands-with-tornado/ |
The multiprocessing package in Python 2.6 std lib works well with Tornado's IO loop. |
I wrote a module for tornado similar to the AsyncHTTPClient just for this purpose. |
Is there a way to run a set of mysql queries in parallel. Bret Taylor's post on mysql explains that they query all mysql shards in parallel. Can we do this in tornado ? |
Well, you might want to leverage the |
Put the data (e.g. filename of the image in question) in a queue Q and process that queue in another process. Python comes already with everything you need: If you want to do that distributed, check out ZeroMQ http://www.zeromq.org |
Tornado 3.0 introduced tornado.process.Subprocess: http://www.tornadoweb.org/en/stable/process.html#tornado.process.Subprocess |
Is there a way to run system commands asynchronously? For instance, let's say you're given an image as input, and you'd like to run some image conversion or optimization program in the background. Can you do this without blocking?
The text was updated successfully, but these errors were encountered: