-
Notifications
You must be signed in to change notification settings - Fork 289
Description
When running the following test in google colaboratry
from fastcore.utils import parallel
from fastcore.test import test_eq
def add_one(x, a=1):
time.sleep(random.random()/80)
return x+a
inp,exp = range(50),range(1,51)
test_eq(parallel(add_one, inp, n_workers=2), exp)
I get the following error:
/usr/local/lib/python3.6/dist-packages/fastcore/utils.py in parallel(f, items, n_workers, total, progress, pause, timeout, chunksize, *args, **kwargs)
704 "Appliesfuncin parallel toitems, usingn_workers"
705 if progress is None: progress = progress_bar is not None
--> 706 with ProcessPoolExecutor(n_workers, pause=pause) as ex:
707 r = ex.map(f,items, *args, timeout=timeout, chunksize=chunksize, **kwargs)
708 if progress:/usr/local/lib/python3.6/dist-packages/fastcore/utils.py in init(self, max_workers, on_exc, pause, mp_context, initializer, initargs)
685 self.not_parallel = max_workers==0
686 if self.not_parallel: max_workers=1
--> 687 super().init(max_workers, mp_context=mp_context, initializer=initializer, initargs=initargs)
688
689 def map(self, f, items, timeout=None, chunksize=1, *args, **kwargs):TypeError: init() got an unexpected keyword argument 'mp_context'
Here is the python version:
!python --version
Python 3.6.9