Closed OyLingji closed 1 year ago
This is the expected behavior. As you say, you can use clear
or restart
. Are you requesting a change in the behavior?
The code is essentially identical to:
from pathos import multiprocessing as mp
def f():
pass
pool = mp.ProcessPool()
pool.apipe(f)
pool.close()
pool.apipe(f)
pool.close()
I'm closing this, as this is the expected behavior and it looks like you aren't requesting a feature change. Feel free to reopen if you have more to add.
Issue
ProcessPool.close()
won't delete thePool
instance in the__STATE
list, and if a newProcessPool
instance with the same_id
is created afterwards, it will search the__STATE
list and get the previously closedPool
.Although there is a
ProcessPool.restart()
method, but trying to restart a pool after its construction is still troubling.Another way to solve this problem is calling
clear()
method, but it may also be confusing for users to aware the__STATE
list.Reproduce
Run the following code:
Get error: