def receive(self):
ret = [ ] <EOL>while True:<EOL><INDENT>if self.runid_pkgidx_map:<EOL><INDENT>self.runid_to_return.extend(self.dispatcher.poll())<EOL>ret.extend(self._collect_all_finished_pkgidx_result_pairs())<EOL><DEDENT>if not self.runid_pkgidx_map:<EOL><INDENT>break<EOL><DEDENT>time.sleep(self.sleep)<EOL><DEDENT>ret = sorted(ret, key=itemgetter(<NUM_LIT:0>))<EOL>return ret<EOL>
return pairs of package indices and results of all tasks

        This method waits until all tasks finish.

        Returns
        -------
        list
            A list of pairs of package indices and results