My ProcessPoolExecutor does not run the whole function

178 Views Asked by At

I need to run a function in parallel with different processes. I am using the code below. My function arguments types are (nested list of binary numbers, int). The problem is when I run the script processes start running but they finish in the middle of the function (check where I put "Here" in the code) without no error.

def CreateP(pattern):
      print("start")
      import pandas as pd
      P=[]
      for j in range( n1):
      
          for i in range(n):
              for i1 in range(n):
                  if i1!=i:

                      #Here (my processes end here)
                      if pattern[i][j]==pattern[i1][j]:
                             
                          
                                if (i,i1,j) not in P:
                                    P.append((i,i1,j))
                                    
                                if (i1,i,j) not in P:
                                    P.append((i1,i,j))
                       
                      else:
                          if pattern[i][j]==1:
                                  if (i1,i,j) not in P:
                              
                                      P.append((i1,i,j)) 
                              
                          else:
                                          if (i,i1,j) not in P:
                                              P.append((i,i1,j))
  
      pd.DataFrame(P).to_csv("test1.csv" ,index=False)
      pd.DataFrame(pattern).to_csv("test2.csv" ,index=False)               
                    
      return P


def main():
        import concurrent.futures
     
        for i in range(a1):
            with concurrent.futures.ProcessPoolExecutor(max_workers=61) as executor:
                f1=executor.submit(CreateP,( Pbig1[i],1))
                f2=executor.submit(CreateP,( Pbig2[i],2))


if __name__ == "__main__":
    main()
0

There are 0 best solutions below