Skip to content
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

Closed
hoisie opened this issue Sep 10, 2009 · 12 comments
Closed

Is there a way to run a system process asynchronously? #2

hoisie opened this issue Sep 10, 2009 · 12 comments

Comments

@hoisie
Copy link

hoisie commented Sep 10, 2009

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?

@greut
Copy link

greut commented Sep 11, 2009

web.by fires up a thread; I've done it by using an external worker.

@lucky
Copy link

lucky commented Oct 3, 2009

You probably want subprocess.

@pitchfork
Copy link

or celery

@yashh
Copy link

yashh commented Dec 31, 2009

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.

@fictorial
Copy link

+1 for yashh

@ghost
Copy link

ghost commented Jan 23, 2010

@parente
Copy link

parente commented Feb 21, 2010

The multiprocessing package in Python 2.6 std lib works well with Tornado's IO loop.

@alexdong
Copy link

I wrote a module for tornado similar to the AsyncHTTPClient just for this purpose.
http://github.com/alexdong/tornado/blob/master/tornado/async_process.py

@yashh
Copy link

yashh commented Oct 24, 2010

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 ?

@alexdong
Copy link

Well, you might want to leverage the async_process and pipe the result into tornado.

@mark-kubacki
Copy link

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:
http://docs.python.org/library/multiprocessing.html

If you want to do that distributed, check out ZeroMQ http://www.zeromq.org

zhaozhouping pushed a commit to zhaozhouping/tornado that referenced this issue Mar 19, 2013
@bdarnell
Copy link
Member

Tornado 3.0 introduced tornado.process.Subprocess: http://www.tornadoweb.org/en/stable/process.html#tornado.process.Subprocess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants