Created
February 2, 2013 16:44
-
-
Save EdLeafe/4698192 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 | |
# -*- coding: utf-8 -*- | |
import eventlet | |
from eventlet.green import urllib2 | |
import time | |
url = "http://daboserver.com/eventlet/%s" | |
def getit(seq): | |
print "requesting", seq | |
resp = urllib2.urlopen(url % seq) | |
print "%s: %s - %s" % (seq, resp.read(), time.ctime()) | |
pool = eventlet.GreenPool(7) | |
for ii in xrange(33): | |
print "Spawning #%s at %s" % (ii, time.ctime()) | |
pool.spawn_n(getit, ii) | |
print "BEFORE waitall" | |
pool.waitall() | |
print "DONE at", time.ctime() | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment