title: Show the progress of a Python multiprocessing pool imap_unordered call?
body: <p>I have a script that's successfully doing a multiprocessing Pool set of tasks with a <code>imap_unordered()</code> call:</p>
  <pre><code>p = multiprocessing.Pool()
  rs = p.imap_unordered(do_work, xrange(num_tasks))
  p.close() # No more work
  p.join() # Wait for completion
  </code></pre>
  <p>However, my <code>num_tasks</code> is around 250,000, and so the <code>join()</code> locks the main thread for 10 seconds or so, and I'd like to be able to echo out to the command line incrementally to show the main process isn't locked. Something like:</p>
  <pre><code>p = multiprocessing.Pool()
  rs = p.imap_unordered(do_work, xrange(num_tasks))
  p.close() # No more work
  while (True):
    remaining = rs.tasks_remaining() # How many of the map call haven't been done yet?
    if (remaining == 0): break # Jump out of while loop
    print(&quot;Waiting for&quot;, remaining, &quot;tasks to complete...&quot;)
    time.sleep(2)
  </code></pre>
  <p>Is there a method for the result object or the pool itself that indicates the number of tasks remaining? I tried using a <code>multiprocessing.Value</code> object as a counter (<code>do_work</code> calls a <code>counter.value += 1</code> action after doing its task), but the counter only gets to ~85% of the total value before stopping incrementing.</p>