I am writing an example program to test the use of a multiprocessor pool of workers in python 2.7.2+
This is the code I wrote in the python ubuntu interpreter
>>> from multiprocessing import Pool >>> def name_append(first_name,last_name): ... return first_name+" "+last_name ... >>> from functools import partial >>> partial_name_append=partial(name_append,'kiran') >>> partial_name_append('acb') 'kiran acb' >>> abc='kiran' >>> pool=Pool(processes=4) >>> pool.map(partial_name_append,abc) ['kiran k', 'kiran i', 'kiran r', 'kiran a', 'kiran n'] >>> pool.close() >>> pool.join() >>> pool.map(partial_name_append,abc) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/multiprocessing/pool.py", line 226, in map assert self._state == RUN AssertionError
After I got the brine errors over my set of working commands for large data sets, I try to make small examples and try to figure out what the error is.
I do not understand why the same statement "pool.map" does not work when it worked above. I think I did the βpool cardβ correctly, but I donβt understand the reason.
Is this error related to "PicklingError: cannot determine: attribute search inline .function failed"
Can someone help me?
thanks
source share