Closed wcmiracle closed 3 years ago
Hello again.
Sure it supports! But only one bar can be visible in the screen, that's the only limitation. Here is an example:
The code (save in a file.py and run python file.py
):
from concurrent.futures import ProcessPoolExecutor, as_completed
from alive_progress import alive_bar
import time, random
def process(work):
time.sleep(random.random())
return work
if __name__ == '__main__':
workables = [x for x in range(20)]
with alive_bar(len(workables)) as bar:
with ProcessPoolExecutor(max_workers=3) as pool:
futures = [pool.submit(process, work) for work in workables]
for future in as_completed(futures):
print('work done:', future.result())
bar()
print('Ok! Everything done.\n')
Thank you very much for the example, it will help others.
You're welcome man.
i want to ues
import multiprocessing from concurrent.futures import ProcessPoolExecutor
support it?