title: Multiprocessing Pool return results as available
body: <p>I'm trying to implement multiprocessing and struggling to get where I need to get.</p>
  
  <p>So some background I have previously done multiprocessing with Celery, so I am used to being able to send jobs to a worker and poll when its done, and get the results of the job even if other jobs are going.  I'm trying to relate this to multiprocessing.  Here is what I have so far, dug up from various sites I have found...</p>
  
  <pre><code>import urllib2
  import time
  from multiprocessing.dummy import Pool as ThreadPool
  import random
  
  def openurl(url):
      time.sleep(random.randrange(1,10))
      print url
      return urllib2.urlopen(url)
  
  
  urls = [
    'http://www.python.org',
    'http://www.python.org/about/',
    'http://www.onlamp.com/pub/a/python/2003/04/17/metaclasses.html',
    'http://www.python.org/doc/',
    'http://www.python.org/download/',
    'http://www.python.org/getit/',
    'http://www.python.org/community/',
    'https://wiki.python.org/moin/',
    'http://planet.python.org/',
    'https://wiki.python.org/moin/LocalUserGroups',
    'http://www.python.org/psf/',
    'http://docs.python.org/devguide/',
    'http://www.python.org/community/awards/'
    # etc..
    ]
  
  pool = ThreadPool(20)
  
  results = pool.map(openurl, urls)
  
  pool.close()
  pool.join()
  print 'now what'
  </code></pre>
  
  <p>So I am kicking off the openurl function on my urls, but if I break at "print 'now what'", it does not break there until all my jobs are complete.  </p>
  
  <p>How can I 'poll' my threads and return the results as they come in?</p>
  
  <p>Thanks!</p>