mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-109595: Add -Xcpu_count=<n> cmdline for container users (#109667)
--------- Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
This commit is contained in:
parent
5aa62a8de1
commit
0362cbf908
15 changed files with 192 additions and 11 deletions
|
@ -546,6 +546,12 @@ Miscellaneous options
|
|||
report Python calls. This option is only available on some platforms and
|
||||
will do nothing if is not supported on the current system. The default value
|
||||
is "off". See also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`.
|
||||
* :samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`,
|
||||
:func:`os.process_cpu_count`, and :func:`multiprocessing.cpu_count`.
|
||||
*n* must be greater than or equal to 1.
|
||||
This option may be useful for users who need to limit CPU resources of a
|
||||
container system. See also :envvar:`PYTHON_CPU_COUNT`.
|
||||
If *n* is ``default``, nothing is overridden.
|
||||
|
||||
It also allows passing arbitrary values and retrieving them through the
|
||||
:data:`sys._xoptions` dictionary.
|
||||
|
@ -593,6 +599,9 @@ Miscellaneous options
|
|||
.. versionadded:: 3.12
|
||||
The ``-X perf`` option.
|
||||
|
||||
.. versionadded:: 3.13
|
||||
The ``-X cpu_count`` option.
|
||||
|
||||
|
||||
Options you shouldn't use
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -1063,6 +1072,15 @@ conflict.
|
|||
|
||||
.. versionadded:: 3.12
|
||||
|
||||
.. envvar:: PYTHON_CPU_COUNT
|
||||
|
||||
If this variable is set to a positive integer, it overrides the return
|
||||
values of :func:`os.cpu_count` and :func:`os.process_cpu_count`.
|
||||
|
||||
See also the :option:`-X cpu_count <-X>` command-line option.
|
||||
|
||||
.. versionadded:: 3.13
|
||||
|
||||
|
||||
Debug-mode variables
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue