def multiprocessor_batch_calc(self, batch_queue): p = Pool(3) prediction = p.map(self.predict_batch, batch_queue) return list(itertools.chain.from_iterable(prediction))