You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know the difference between Pool.close() and Pool.terminate. The documentation has the following to say:
close() → None
Close the pool to new visitors.
terminate() → None
No running by the pool!
Which is unclear. I thought close would prevent new tasks from being applied, and terminate would stop all currently running tasks, but that doesn't seem to be the case.
The text was updated successfully, but these errors were encountered:
This could definitely stand to have better documentation. pool.close() prevents queueing new tasks, and queues commands to the child processes so that they can gracefully stop once the work queue is exhausted, and you can await pool.join() to wait for them to finish. pool.terminate() will immediately terminate (kill -9) those workers, leaving the work queue unfinished, and any pending jobs will be stuck waiting for results, so it should only be used when the service managing the pool must exit immediately without waiting for any in-flight tasks/results.
Description
I would like to know the difference between Pool.close() and Pool.terminate. The documentation has the following to say:
Which is unclear. I thought
close
would prevent new tasks from being applied, andterminate
would stop all currently running tasks, but that doesn't seem to be the case.The text was updated successfully, but these errors were encountered: