# forward compatibility
try:
from tqdm.auto import tqdm
except NameError:
from tqdm import tqdm_notebook as tqdm
# progress bar that blocks until completion
def blocking_pbar(futures, **kwargs):
pbar = tqdm(dd.as_completed(futures), total=len(futures), **kwargs)
for _ in pbar:
errors = [f for f in futures if f.status == 'error']
if len(errors) > 0:
pbar.set_postfix({'errors': len(errors)})