title: parallel excution and file writing on python
body: <p>I have a very large datasets distributed in 10 big clusters and the task is to do some computations for each cluster and write (append) the results line by line into 10 files where each file contains the results obtained corresponding to each one of the 10 clusters, each cluster can be computed independently, and I want to parallelize the code into ten CPUs (or threads) such that I can do the computations on all the clusters at once, a simplified pseudo code for my task is the following:</p>
  
  <pre><code>for(c in range (1,10)):  #this is the loop over the clusters
      for(l in "readlines from cluster C")
           # do some computations for line l in cluster c
           # append the results in file named "cluster_c" one file for each cluter c
  </code></pre>