From 2130fec62c68138ffa24bbe69d6d302823363785 Mon Sep 17 00:00:00 2001 From: Robert Meyer Date: Tue, 20 Feb 2018 18:00:42 +0100 Subject: [PATCH] imap for better memory management --- trufflepig/preprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trufflepig/preprocessing.py b/trufflepig/preprocessing.py index a8b76ef..8ebe1c3 100644 --- a/trufflepig/preprocessing.py +++ b/trufflepig/preprocessing.py @@ -33,7 +33,7 @@ def apply_parallel(function, iterable, ncores, chunksize=1000): ctx = mp.get_context('spawn') pool = ctx.Pool(ncores) - results = [x for x in pool.map(function, iterable, chunksize)] + results = [x for x in pool.imap(function, iterable, chunksize)] pool.close() pool.join()