Skip to content

Instantly share code, notes, and snippets.

@clayg
Created June 18, 2015 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/1313818bbf96688d0427 to your computer and use it in GitHub Desktop.
Save clayg/1313818bbf96688d0427 to your computer and use it in GitHub Desktop.
#!/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