RhodiumGroup / rhg_compute_tools

Tools for using compute.rhg.com and compute.impactlab.org
MIT License
1 stars 4 forks source link

add a blocking_pbar #54

Closed delgadom closed 4 years ago

delgadom commented 4 years ago
# 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)})
delgadom commented 4 years ago

lol. This is the same thing as #53. Focus, @delgadom.