Skip to content
Snippets Groups Projects
Commit 8ea3a872 authored by Radek Hušek's avatar Radek Hušek
Browse files

parmap: add test case

parent f226fd1d
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,16 @@ def parmap(f, X, nprocs = None, chunksize = 1, chunks_in_flight = None, ...@@ -83,6 +83,16 @@ def parmap(f, X, nprocs = None, chunksize = 1, chunks_in_flight = None,
>>> list(parmap(lambda x: x+1, range(10))) >>> list(parmap(lambda x: x+1, range(10)))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> from time import sleep
>>> def w(d):
... sleep(d)
... while d < 3:
... yield d
... sleep(1)
... d += 1
>>> list(parmap(w, [0, 0.5], nprocs=2, multimap=True, in_order=False, out_chunksize=1))
[0, 0.5, 1, 1.5, 2, 2.5]
""" """
if nprocs is None: if nprocs is None:
nprocs = multiprocessing.cpu_count() nprocs = multiprocessing.cpu_count()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment