RE: How to execute a script from another script and other script doesnotdo busy wait.

Discussion in 'Python' started by VYAS ASHISH M-NTB837, Jan 7, 2010.

  1. Use threads

    Regards,
    Ashish Vyas

    -----Original Message-----
    From: python-list-bounces+ntb837=
    [mailto:python-list-bounces+ntb837=] On Behalf Of
    Rajat
    Sent: Thursday, January 07, 2010 2:42 PM
    To:
    Subject: How to execute a script from another script and other script
    does notdo busy wait.

    I want to run a python script( aka script2) from another python script
    (aka script1). While script1 executes script2 it waits for script2 to
    complete and in doing so it also does some other useful work.(does not
    do a busy wait).

    My intention is to update a third party through script1 that script2 is
    going to take longer.
    VYAS ASHISH M-NTB837, Jan 7, 2010
    #1
    1. Advertising

  2. VYAS ASHISH M-NTB837

    Rajat Guest

    On Jan 7, 2:21 pm, "VYAS ASHISH M-NTB837" <>
    wrote:
    > Use threads
    >
    > Regards,
    > Ashish Vyas
    >
    >
    >
    > -----Original Message-----
    > From: python-list-bounces+ntb837=
    >
    > [mailto:python-list-bounces+ntb837=] On Behalf Of
    > Rajat
    > Sent: Thursday, January 07, 2010 2:42 PM
    > To:
    > Subject: How to execute a script from another script and other script
    > does notdo busy wait.
    >
    > I want to run a python script( aka script2) from another python script
    > (aka script1). While script1 executes script2 it waits for script2 to
    > complete and in doing so it also does some other useful work.(does not
    > do a busy wait).
    >
    > My intention is to update a third party through script1 that script2 is
    > going to take longer.- Hide quoted text -
    >
    > - Show quoted text -


    Thanks Ashish.

    I've single CPU machine. I've a feeling that the thread created, which
    would run script2, would eat up all of the CPU if I do not use sleep()
    in script2.

    That way, script1 would still be waiting for script2 to finish. Thus,
    my program is no way different from the sample program I posted
    earlier.

    Is there any other way out?
    Rajat, Jan 7, 2010
    #2
    1. Advertising

  3. Rajat <> wrote:

    > I've single CPU machine. I've a feeling that the thread created, which
    > would run script2, would eat up all of the CPU if I do not use sleep()
    > in script2.


    > That way, script1 would still be waiting for script2 to finish.


    Single CPU is not a problem for threads (in fact it's even better).
    It'll work. Try it.

    Another possibility is to run script2 in a separate process (e.g. using
    subprocess module).

    Cheers,
    *j
    Jan Kaliszewski, Jan 7, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,945
    -berlin.de
    Mar 1, 2004
  2. Paul L. Du Bois

    Queue.Queue-like class without the busy-wait

    Paul L. Du Bois, Mar 24, 2005, in forum: Python
    Replies:
    29
    Views:
    1,038
    Antoon Pardon
    Apr 4, 2005
  3. black_13
    Replies:
    2
    Views:
    535
    Matt Nordhoff
    Feb 15, 2008
  4. Rajat
    Replies:
    3
    Views:
    680
    Jorgen Grahn
    Jan 8, 2010
  5. Hal Vaughan
    Replies:
    0
    Views:
    578
    Hal Vaughan
    Sep 12, 2005
Loading...

Share This Page