Skip to content

Commit b71e4b3

Browse files
committed
Fix PoolExecutor.map
1 parent 282a11b commit b71e4b3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

charm4py/pool.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,15 @@ def __call__(self, args_kwargs):
527527
return self.fn(*in_args, **in_kwargs)
528528

529529

530+
@dataclass
531+
class _StarmappedFunction:
532+
533+
fn: Callable
534+
535+
def __call__(self, args_iterable):
536+
return self.fn(*args_iterable)
537+
538+
530539
class PoolExecutor(Executor):
531540

532541
def __init__(self, pool_scheduler_chare):
@@ -551,7 +560,7 @@ def map(self, func, *iterables, timeout=None, chunksize=1, ncores=-1):
551560
"charm4py.pool.PoolExecutor object has been shut down")
552561

553562
with Timeout(timeout, TimeoutError) as timeout:
554-
result = self.pool.map(func, zip(*iterables),
563+
result = self.pool.map(_StarmappedFunction(func), list(zip(*iterables)),
555564
chunksize=chunksize, ncores=ncores)
556565

557566
return result

0 commit comments

Comments
 (0)