I have defined a python 2.7 file with many different classes.
Within this classes I have defined many different functions which can be called once the class is set to a variable.
Within one of this functions I have defined another function which I would like to use for multiprocessing.
See the "addValue" function example below (this example represents what I would like to achieve)
import multiprocessing as mulpro
import numpy
class Scatter():
def function1():
...
def function2():
...
def addValue(self):
x = range(10) #variable which would contain the data
def targetFunction(Value):
return (Value + numpy.random.uniform(0,1))
pool = mulpro.Pool(processes=4)
print pool.map(targetFunction, x)
When I try to run a code close to this example I get this error from the "map" function:
Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
Any help please? If there is solution it must follow the "Class" hierarchy seen on the example above...