最佳答案
I have a multithreaded function that I would like a status bar for using tqdm
. Is there an easy way to show a status bar with ThreadPoolExecutor
? It is the parallelization part that is confusing me.
import concurrent.futures
def f(x):
return f**2
my_iter = range(1000000)
def run(f,my_iter):
with concurrent.futures.ThreadPoolExecutor() as executor:
function = list(executor.map(f, my_iter))
return results
run(f, my_iter) # wrap tqdr around this function?