Skip to content

Instantly share code, notes, and snippets.

@EdLeafe
Created February 2, 2013 16:44
Show Gist options
  • Save EdLeafe/4698192 to your computer and use it in GitHub Desktop.
Save EdLeafe/4698192 to your computer and use it in GitHub Desktop.
#!/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