summaryrefslogtreecommitdiffstats
path: root/Doc/library/multiprocessing.rst
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-04-19 14:27:00 (GMT)
committerGitHub <noreply@github.com>2022-04-19 14:27:00 (GMT)
commit061a8bf77c80036bed3ef4973fe0c99705c83fc6 (patch)
tree19c2418fd5877d4b3cc211e7f40eff5ad5397a08 /Doc/library/multiprocessing.rst
parent74070085da5322ac83c954f101f2caa150655be2 (diff)
downloadcpython-061a8bf77c80036bed3ef4973fe0c99705c83fc6.zip
cpython-061a8bf77c80036bed3ef4973fe0c99705c83fc6.tar.gz
cpython-061a8bf77c80036bed3ef4973fe0c99705c83fc6.tar.bz2
gh-91231: Add shutdown_timeout to multiprocessing BaseManager (#32112)
Add an optional keyword 'shutdown_timeout' parameter to the multiprocessing.BaseManager constructor. Kill the process if terminate() takes longer than the timeout. Multiprocessing tests pass test.support.SHORT_TIMEOUT to BaseManager.shutdown_timeout.
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r--Doc/library/multiprocessing.rst16
1 files changed, 15 insertions, 1 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index ee40688..83aa5cb 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -1676,7 +1676,7 @@ Manager processes will be shutdown as soon as they are garbage collected or
their parent process exits. The manager classes are defined in the
:mod:`multiprocessing.managers` module:
-.. class:: BaseManager([address[, authkey]])
+.. class:: BaseManager(address=None, authkey=None, serializer='pickle', ctx=None, *, shutdown_timeout=1.0)
Create a BaseManager object.
@@ -1691,6 +1691,20 @@ their parent process exits. The manager classes are defined in the
*authkey* is ``None`` then ``current_process().authkey`` is used.
Otherwise *authkey* is used and it must be a byte string.
+ *serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or
+ ``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization).
+
+ *ctx* is a context object, or ``None`` (use the current context). See the
+ :func:`get_context` function.
+
+ *shutdown_timeout* is a timeout in seconds used to wait until the process
+ used by the manager completes in the :meth:`shutdown` method. If the
+ shutdown times out, the process is terminated. If terminating the process
+ also times out, the process is killed.
+
+ .. versionchanged: 3.11
+ Added the *shutdown_timeout* parameter.
+
.. method:: start([initializer[, initargs]])
Start a subprocess to start the manager. If *initializer* is not ``None``