can't use multiprocessing with class factory?
Alan
alan.isaac at gmail.com
Fri Jan 28 15:26:12 EST 2011
On Jan 28, 2:23 pm, Robert Kern <robert.k... at gmail.com> wrote:
> Send the (pickleable) factory and the arguments used to construct the instance,
> not the unpickleable instance itself.
>
> def g(factory, i):
> cls = factory(i)
> print cls._x
>
> if __name__ == '__main__':
> pool = mp.Pool(2)
> pool.map(g, zip([class_factory] * 4, range(4)))
If I change that to g((factory,i)) it does work.
Thanks!
Alan
More information about the Python-list
mailing list