Best Way To Bound Function Execution Time

Discussion in 'Python' started by Tim Daneliuk, Dec 31, 2011.

  1. Tim Daneliuk

    Tim Daneliuk Guest

    I am writing some paramiko-based ssh routines. One of them logs into
    a remote server and then does a sudo command. The problem is that if
    the user provides the incorrect sudo password, the call hangs the other
    end is waiting for the correct password to be entered.

    Is there some standard Pythonic way to bound how long a function
    call can run, after which time it is forcefully terminated?

    TIA,
    --
    ----------------------------------------------------------------------------
    Tim Daneliuk
    PGP Key: http://www.tundraware.com/PGP/
     
    Tim Daneliuk, Dec 31, 2011
    #1
    1. Advertisements

  2. Tim Daneliuk

    Paul Rubin Guest

    Tim Daneliuk <> writes:
    > Is there some standard Pythonic way to bound how long a function
    > call can run, after which time it is forcefully terminated?


    Basically, run it in a separate process and use os.kill to kill it.
     
    Paul Rubin, Dec 31, 2011
    #2
    1. Advertisements

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. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,853
    thushara wijeratna
    Oct 7, 2008
  2. Replies:
    8
    Views:
    569
    Oliver Wong
    Mar 29, 2006
  3. Rhiner Dan
    Replies:
    1
    Views:
    973
    Mike Wahler
    Mar 27, 2005
  4. Mario Krsnic
    Replies:
    0
    Views:
    559
    Mario Krsnic
    Jun 23, 2006
  5. flamesrock
    Replies:
    8
    Views:
    807
    Hendrik van Rooyen
    Nov 24, 2006
  6. Max2006
    Replies:
    2
    Views:
    476
    Max2006
    Jul 26, 2007
  7. Anthony Sullivan

    Bound DropDownList: What is the best way?

    Anthony Sullivan, Dec 22, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    304
    Anthony Sullivan
    Dec 22, 2003
  8. Fabiano

    Best way to bound a webcontrol

    Fabiano, Apr 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    155
    Jeffrey Tan[MSFT]
    Apr 9, 2004
Loading...