def iparallel_progbar ( mapper , iterable , nprocs = None , starmap = False , flatmap = False , shuffle = False , verbose = True , verbose_flatmap = None , max_cache = - 1 , * * kwargs ) : results = _parallel_progbar_launch ( mapper , iterable , nprocs , starmap , flatmap , shuffle , verbose , verbose_flatmap , max_cache , * * kwargs ) return ( x for i , x in results )
python add progress bar in multiprocessing starmap
Performs a parallel mapping of the given iterable reporting a progress bar as values get returned . Yields objects as soon as they re computed but does not guarantee that they ll be in the correct order .
def iparallel_progbar(mapper, iterable, nprocs=None, starmap=False, flatmap=False, shuffle=False,
                      verbose=True, verbose_flatmap=None, max_cache=-1, **kwargs):
    """Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned. Yields
    objects as soon as they're computed, but does not guarantee that they'll be in the correct order.

    :param mapper: The mapping function to apply to elements of the iterable
    :param iterable: The iterable to map
    :param nprocs: The number of processes (defaults to the number of cpu's)
    :param starmap: If true, the iterable is expected to contain tuples and the mapper function gets each element of a
        tuple as an argument
    :param flatmap: If true, flatten out the returned values if the mapper function returns a list of objects
    :param shuffle: If true, randomly sort the elements before processing them. This might help provide more uniform
        runtimes if processing different objects takes different amounts of time.
    :param verbose: Whether or not to print the progress bar
    :param verbose_flatmap: If performing a flatmap, whether or not to report each object as it's returned
    :param max_cache: Maximum number of mapped objects to permit in the queue at once
    :param kwargs: Any other keyword arguments to pass to the progress bar (see ``progbar``)
    :return: A list of the returned objects, in whatever order they're done being computed
    """

    results = _parallel_progbar_launch(mapper, iterable, nprocs, starmap, flatmap, shuffle, verbose,
                                       verbose_flatmap, max_cache, **kwargs)
    return (x for i, x in results)