Files
Mark Aron Szulyovszky 8dd2d88740 chore(Linter): reformatted code with black (#211)
* chore(Linter): reformatted code with black

* Create black.yaml
2022-02-17 19:22:17 +01:00

16 lines
345 B
Python

from tqdm import tqdm
import ray
def parallel_compute_with_bar(computations) -> list:
def to_iterator(obj_ids):
while obj_ids:
done, obj_ids = ray.wait(obj_ids)
yield ray.get(done[0])
ret = []
for x in tqdm(to_iterator(computations), total=len(computations)):
ret.append(x)
return ret