I have the following problem: I would like to use a amap from pathos.multiprocessing.
import pathos as pt
class Foo:
def __init__(self):
pass
def f(self, a, b, c):
return a + b + c
def g(self):
pool = pt.multiprocessing.ProcessPool()
def _h(a, b, c):
k = self.f(a, b, c)
return k/2
result = [pool.amap(_h, (i, j, k)) for i in range(3) for j in range(5) for k in range(7)]
return result
a = Foo()
b = a.g()
b[0].get()
It is necessary to have these two function f and g although I could do everything within f.
If I run this code I get that g expects 3 arguments but one was given.
TypeError: _h() takes exactly 3 arguments (1 given)
How can I fix this?