[IPython-dev] Does Ipython have the equivalent to the 'wait' keyword in bash?

Erik Tollerud erik.tollerud at gmail.com
Wed Dec 16 19:50:08 EST 2009


I'm not sure if there is any builtin ipython magic that does this, but
one potential approach might be:


import subprocess

p1=subprocess.Popen('cmd1')
p2=subprocess.Popen('cmd2')
p3=subprocess.Popen('cmd3')

#do your other stuff

p1.wait()
p2.wait()
p3.wait()

print 'Done!'



On Thu, Dec 10, 2009 at 5:41 AM, Sarbak, Joseph <Joseph.Sarbak at rbccm.com> wrote:
>
>
> Hello,
>
> Firstly, I would like to let you know that Ipython is a wonderful
> interpreter, and I would like to use it as my shell. Thanks for your
> hard work.
>
> However, there is one question I have, for which I have tried to find a
> solution in the documentation.  I haven't found any advice in the docs
> so, here goes...
>
> Just as in bash, I would like to launch multiple processes in the
> background and then at some point in the parent script, wait for the
> results.  It is so easy to do in most shell languages.  Example:
>
>        #!/bin/bash
>
>        task1&
>        task2&
>        task3&
>
>        # do some other work
>
>        wait
>
>        echo "Done!"
>
> Would anyone be able to recommend a simple or even trivial way to
> perform the same parallelization work in ipython?  I would like to be
> able to do this on the local node.  No distributed processing is
> desired.
>
> Thank you.
> Joe Sarbak
> ________________________________________
>
> This E-Mail (including any attachments) may contain privileged or confidential information.  It is intended only for the addressee(s) indicated above.
>
> The sender does not waive any of its rights, privileges or other protections respecting this information.
>
> Any distribution, copying or other use of this E-Mail or the information it contains, by other than an intended recipient, is not sanctioned and is prohibited.
>
> If you received this E-Mail in error, please delete it and advise the sender (by return E-Mail or otherwise) immediately.
>
> This E-Mail (including any attachments) has been scanned for viruses.
>
> It is believed to be free of any virus or other defect that might affect any computer system into which it is received and opened.
>
> However, it is the responsibility of the recipient to ensure that it is virus free.
>
> The sender accepts no responsibility for any loss or damage arising in any way from its use.
>
> E-Mail received by or sent from RBC Capital Markets is subject to review by Supervisory personnel.
>
> Such communications are retained and may be produced to regulatory authorities or others with legal rights to the information.
>
> IRS CIRCULAR 230 NOTICE:  TO COMPLY WITH U.S. TREASURY REGULATIONS, WE ADVISE YOU THAT ANY U.S. FEDERAL TAX ADVISE INCLUDED IN THIS COMMUNICATION IS NOT INTENDED OR WRITTEN TO BE USED, AND CANNOT BE USED, TO AVOID ANY U.S. FEDERAL TAX PENALTIES OR TO PROMOTE, MARKET, OR RECOMMEND TO ANOTHER PARTY ANY TRANSACTION OR MATTER.
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



More information about the IPython-dev mailing list