A parallel equivalent of the map() builtin function. It blocks till the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these chunks can be specified by setting
(self, func, iterable, chunksize=None)
| 117 | return self.apply_async(func, args, kwds).get() |
| 118 | |
| 119 | def map(self, func, iterable, chunksize=None): |
| 120 | """A parallel equivalent of the map() builtin function. It |
| 121 | blocks till the result is ready. |
| 122 | |
| 123 | This method chops the iterable into a number of chunks which |
| 124 | it submits to the process pool as separate tasks. The |
| 125 | (approximate) size of these chunks can be specified by setting |
| 126 | chunksize to a positive integer.""" |
| 127 | return self.map_async(func, iterable, chunksize).get() |
| 128 | |
| 129 | def imap(self, func, iterable, chunksize=1): |
| 130 | """ |
no test coverage detected