In the Python multiprocessing
library, is there a variant of pool.map
which supports multiple arguments?
text = "test"
def
Another way is to pass a list of lists to a one-argument routine:
import os
from multiprocessing import Pool
def task(args):
print "PID =", os.getpid(), ", arg1 =", args[0], ", arg2 =", args[1]
pool = Pool()
pool.map(task, [
[1,2],
[3,4],
[5,6],
[7,8]
])
One can than construct a list lists of arguments with one's favorite method.