Commit 83991a54 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

cleanup and formatting

parent fb531a80
Loading
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@

import logging
from itertools import product
from multiprocessing import Pool
from multiprocessing import Pool, cpu_count
from time import sleep

from ivas_processing_scripts.audiotools.metadata import check_ISM_metadata
@@ -164,20 +164,24 @@ def main(args):
            )

        if cfg.multiprocessing:
            # set up values for progress display and chunksize
            count = len(item_args)
            width = 80
            chunksize = count / cpu_count()

            # submit tasks to the pool
            p = Pool()
            chunksize = 8
            results = p.starmap_async(
                process_item,
                item_args,
                chunksize,
            )
            width = 80
            count = len(item_args)

            # poll progress
            progressbar_update(0, count, width)
            while not results.ready():
                progressbar_update(
                    count - (results._number_left * chunksize), count, width
                    count - int(results._number_left * chunksize), count, width
                )
                sleep(0.1)

+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ def pairwise(iter):
def progressbar_update(progress, count, width):
    fill = int(width * progress / count)
    print(
        f"{int(progress/count*100):3d}%{'|'}{'='*fill}{(' '*(width-fill))}{'|'}{progress}/{count}",
        f"{int(progress/count*100):3d}%{'|'}{'='*fill}{(' '*(width-fill))}{'|'}{progress:4d}/{count:4d}",
        end="\r",
        file=sys.stdout,
        flush=True,