def join(self):
        """Block until all workers are terminated."""
        for w in self._workers:
            if w.is_alive():
                w.join()

        if self._profiling_enabled:
            # If we have profiling set, collect stats and print them
            stats = None
            for w in self._workers:
                if stats:
                    stats.add(w.prof)
                else:
                    stats = pstats.Stats(w.prof)
            stats.sort_stats('cumulative').print_stats()
Block until all workers are terminated.
petastorm/workers_pool/thread_pool.py