title: python Pool with worker Processes
body: <p>I am trying to use a worker Pool in python using Process objects.  Each worker (a Process) does some initialization (takes a non-trivial amount of time), gets passed a series of jobs (ideally using <code>map()</code>), and returns something.  No communication is necessary beyond that.  However, I can't seem to figure out how to use map() to use my worker's <code>compute()</code> function.</p>
  
  <pre><code>from multiprocessing import Pool, Process
  
  class Worker(Process):
      def __init__(self):
          print 'Worker started'
          # do some initialization here
          super(Worker, self).__init__()
  
      def compute(self, data):
          print 'Computing things!'
          return data * data
  
  if __name__ == '__main__':
      # This works fine
      worker = Worker()
      print worker.compute(3)
  
      # workers get initialized fine
      pool = Pool(processes = 4,
                  initializer = Worker)
      data = range(10)
      # How to use my worker pool?
      result = pool.map(compute, data)
  </code></pre>
  
  <p>Is a job queue the way to go instead, or can I use <code>map()</code>?</p>