[Tutor] Start multiple threads from Python
Ryan Waples
ryan.waples at gmail.com
Mon Aug 5 21:28:48 CEST 2013
Thanks, that may be just what I'm looking for.
-ryan
On Mon, Aug 5, 2013 at 12:26 PM, Chris Down <chris at chrisdown.name> wrote:
> On 2013-08-05 12:17, Ryan Waples wrote:
> > Currently I am calling each analysis program one at a time with
> > subprocess.call(). This is working without a hitch, but as each analysis
> > can take a while to run, I want to try to speed things up. I realize I
> can
> > start three different python sessions to do this, but that just begs the
> > question how to do that from python?
>
> subprocess.Popen does not block unless you explicitly tell it to (by using
> communicate()). Perhaps that's what you want.
>
> >>> import subprocess
> >>> x = subprocess.Popen([ "sleep", "60" ])
> >>> y = subprocess.Popen([ "sleep", "60" ])
> >>> x.pid
> 3035
> >>> y.pid
> 3036
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130805/c178236f/attachment.html>
More information about the Tutor
mailing list