title: Python pool spawining pools
body: <p>I have a function which uses <code>multiprocessing.Pool</code> to process all the data in <strong>one</strong> dataset in parallel.</p>
  
  <pre><code>from multiprocessing import Pool
  ...
  def func():
      ...
      p = Pool(processes=N)
      p.map(func, params)
      ...
  </code></pre>
  
  <p>However, I now want to run this for <code>M</code> different datasets in parallel. So I have written another script on top of my existing one above. I tried using <code>Pool</code> again to create <code>M</code> processes (each of which would spawn a <code>Pool</code> of <code>N</code> processes). However, I get an error about a daemon not be able to spawn children (which sounds very rock 'n' roll). So I do some reading and switch out <code>Pool</code> for the little know <code>multiprocessing.pool.ThreadPool</code>. So it looks like</p>
  
  <pre><code>p = ThreadPool(processes=M)
  p.starmap(func, args)
  </code></pre>
  
  <p>However, when I run this, I see that <code>ThreadPool</code> is only processing one dataset at a time. So what should I be using to be able to have a script which spawns <code>M</code> children, each of which spawn <code>N</code> children and does it all in parallel.</p>