I'm trying to use tqdm
through multi processes. And the behavior is not as expected. I think the point is that the value of pbar
doesn't update through the processes. So how to deal with this problem? I have also tried to use Value
to update pbar.n
manually, but still failed. It seems tqdm
doesn't support update value and render manually.
def test(lock, pbar):
for i in range(10000):
sleep(0.1)
lock.acquire()
pbar.update()
lock.release()
pbar = tqdm(total = 10000)
lock = Lock()
for i in range(5):
Process(target = test, args = (lock, pbar))