title: Executing tasks in parallel in python
body: <p>I am using python 2.7, I have some code that looks like this:</p>
  
  <pre><code>task1()
  task2()
  task3()
  dependent1()
  
  task4()
  task5()
  task6()
  dependent2()
  
  dependent3()
  </code></pre>
  
  <p>The only dependencies here are as follows: dependent1 needs to wait for tasks1-3, dependent2 needs to wait for tasks 4-6 and dependent3 needs to wait for dependents1-2... The following would be okay: running the whole 6 tasks first in parallel, then the first two dependents in parallel.. then the final dependent</p>
  
  <p>I prefer to have as much tasks as possible running in parallel, I've googled for some modules but I was hoping to avoid external libraries, and not sure how the Queue-Thread technique can solve my problem (maybe someone can recommend a good resource?)</p>