pythonmultiprocessingpool

multiprocessing.pool.Pool string back to object


I'm trying to send a pool to a string and then get it back later to close/join the pool. Here's an example of how to duplicate what I'm doing:

import multiprocessing

num_of_p = 5
_pool = multiprocessing.Pool(num_of_p)
pool_string = str(_pool)

Is there a way to turn pool_string back into a multiprocessing.pool.Pool object?


Solution

  • As user2357112 said, the answer is you can't do this in python. After doing some research I couldn't find any way for it to work. using a string of a memory location and building a new object of the same type off of that.