mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 03:34:48 +08:00
Fix multiprocessing starmap to allow passing in zip (#13664)
This commit is contained in:
@@ -340,6 +340,7 @@ def test_starmap(pool):
|
||||
|
||||
args = [tuple(range(i)) for i in range(100)]
|
||||
assert pool.starmap(f, args) == args
|
||||
assert pool.starmap(lambda x, y: x + y, zip([1, 2], [3, 4])) == [4, 6]
|
||||
|
||||
|
||||
def test_callbacks(pool_4_processes):
|
||||
|
||||
@@ -494,7 +494,7 @@ class Pool:
|
||||
def _chunk_and_run(self, func, iterable, chunksize=None,
|
||||
unpack_args=False):
|
||||
if not hasattr(iterable, "__len__"):
|
||||
iterable = [iterable]
|
||||
iterable = list(iterable)
|
||||
|
||||
if chunksize is None:
|
||||
chunksize = self._calculate_chunksize(iterable)
|
||||
|
||||
Reference in New Issue
Block a user