def get ( self ) : if self . closed : raise PoolClosed ( ) while self . _getcount not in self . _cache : counter , result = self . outq . get ( ) self . _cache [ counter ] = result result , succeeded = self . _cache . pop ( self . _getcount ) self . _getcount += 1 if not succeeded : klass , exc , tb = result raise klass , exc , tb return result
python multiprocessing pool get results while pool is still running
retrieve a result from the pool
def get(self):
        """retrieve a result from the pool

        if nothing is already completed when this method is called, it will
        block until something comes back

        if the pool's function exited via exception, that will come back as
        a result here as well, but will be re-raised in :meth:`get`.

        .. note::
            if there is nothing in the pool's output queue when this method is
            called, it will block until something is ready

        :returns:
            a return value from one of the function's invocations if it exited
            normally

        :raises:
            :class:`PoolClosed` if the pool was closed before a result could be
            produced for thie call

        :raises: any exception that was raised inside the worker function
        """
        if self.closed:
            raise PoolClosed()

        while self._getcount not in self._cache:
            counter, result = self.outq.get()
            self._cache[counter] = result

        result, succeeded = self._cache.pop(self._getcount)
        self._getcount += 1

        if not succeeded:
            klass, exc, tb = result
            raise klass, exc, tb
        return result