multiprocessing.Process call blocks other processes from running

MRAB python at mrabarnett.plus.com
Sat Jan 14 15:10:02 EST 2017


On 2017-01-14 19:05, Joseph L. Casale wrote:
>>  while True:
>>    for client in clients:
>>      stats = ThreadStats()
>>      stats.start()
>>      p = Process(target=getWhispererLogsDirSize, args=(client,queue,))
>>      jobs.append(p)
>>      p.start()
>>      p.join()
>
> You start one client then join before starting the next...
>
> Start them all and push the pointer the resulting process object into a collection.
> Then use whatever semantics you desire to wait them all...
>
To me it also looks slightly odd that you're creating a ThreadStats
instance each time around the loop, and the only other reference to it
is to the last one created, and that line's indentation puts it outside
the """if __name__ == '__main__':""" block.



More information about the Python-list mailing list