Created
June 18, 2015 22:32
-
-
Save clayg/1313818bbf96688d0427 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import eventlet | |
try: | |
wait, timeout = (float(x) for x in sys.argv[1:]) | |
except Exception: | |
sys.exit('USAGE: %s <wait> <timeout>' % sys.argv[0]) | |
def do_a_thing(): | |
eventlet.sleep(wait) | |
print "I have done a thing" | |
print "I am going to do a thing, it better not take to long" | |
gt = eventlet.spawn(do_a_thing) | |
with eventlet.Timeout(timeout, False): | |
gt.wait() | |
print "I am done waiting on the thing" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment