In my code, I have the following lines:
with ThreadPoolExecutor() as pool:
for results in pool.map(load_bucket, buckets):
res_list.append(results)
I'm trying to break the map, as soon as the list res_list reaches a certain length. I've tried the following:
with ThreadPoolExecutor() as pool:
for results in pool.map(load_bucket, buckets):
if len(res_list)- bucket_size < number_reviews:
res_list.append(results)
else:
break
This doesn't seem to work.