File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -415,6 +415,19 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
415415 require the *fork * start method for :class: `ProcessPoolExecutor ` you must
416416 explicitly pass ``mp_context=multiprocessing.get_context("fork") ``.
417417
418+ .. method :: terminate_workers(signal=signal.SIGTERM)
419+
420+ Attempt to terminate all living worker processes immediately by sending each
421+ of them the given signal. If the signal is not specified, the default signal
422+ :data: `signal.SIGTERM ` is used.
423+
424+ After calling :meth: `ProcessPoolExecutor.terminate_workers `, the caller, should
425+ no longer submit tasks to the executor. It is also recommended to still call
426+ :meth: `ProcessPoolExecutor.shutdown ` to ensure that all other resources
427+ associated with the executor are freed.
428+
429+ .. versionadded :: 3.14
430+
418431.. _processpoolexecutor-example :
419432
420433ProcessPoolExecutor Example
Original file line number Diff line number Diff line change @@ -306,6 +306,9 @@ concurrent.futures
306306 incompatible *fork * start method you must explicitly request it by
307307 supplying a *mp_context * to :class: `concurrent.futures.ProcessPoolExecutor `.
308308 (Contributed by Gregory P. Smith in :gh: `84559 `.)
309+ * Add :meth: `concurrent.futures.ProcessPoolExecutor.terminate_workers ` as
310+ a way to terminate all living worker processes in the given pool.
311+ (Contributed by Charles Machalow in :gh: `128043 `.)
309312
310313ctypes
311314------
You can’t perform that action at this time.
0 commit comments