Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
39889864
Kaydet (Commit)
39889864
authored
May 08, 2019
tarafından
Brian Quinlan
Kaydeden (comit)
Steve Dower
May 08, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-26903: Limit ProcessPoolExecutor to 61 workers on Windows (GH-13132)
Co-Authored-By:
brianquinlan
<
brian@sweetapp.com
>
üst
b9b08cd9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
concurrent.futures.rst
Doc/library/concurrent.futures.rst
+4
-0
process.py
Lib/concurrent/futures/process.py
+14
-0
test_concurrent_futures.py
Lib/test/test_concurrent_futures.py
+7
-0
2019-05-06-19-17-04.bpo-26903.4payXb.rst
...S.d/next/Library/2019-05-06-19-17-04.bpo-26903.4payXb.rst
+2
-0
No files found.
Doc/library/concurrent.futures.rst
Dosyayı görüntüle @
39889864
...
...
@@ -216,6 +216,10 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
given, it will default to the number of processors on the machine.
If *max_workers* is lower or equal to ``0``, then a :exc:`ValueError`
will be raised.
On Windows, *max_workers* must be equal or lower than ``61``. If it is not
then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then
the default chosen will be at most ``61``, even if more processors are
available.
*mp_context* can be a multiprocessing context or None. It will be used to
launch the workers. If *mp_context* is ``None`` or not given, the default
multiprocessing context is used.
...
...
Lib/concurrent/futures/process.py
Dosyayı görüntüle @
39889864
...
...
@@ -57,6 +57,7 @@ import threading
import
weakref
from
functools
import
partial
import
itertools
import
sys
import
traceback
# Workers are created as daemon threads and processes. This is done to allow the
...
...
@@ -109,6 +110,12 @@ def _python_exit():
EXTRA_QUEUED_CALLS
=
1
# On Windows, WaitForMultipleObjects is used to wait for processes to finish.
# It can wait on, at most, 63 objects. There is an overhead of two objects:
# - the result queue reader
# - the thread wakeup reader
_MAX_WINDOWS_WORKERS
=
63
-
2
# Hack to embed stringification of remote traceback in local traceback
class
_RemoteTraceback
(
Exception
):
...
...
@@ -505,9 +512,16 @@ class ProcessPoolExecutor(_base.Executor):
if
max_workers
is
None
:
self
.
_max_workers
=
os
.
cpu_count
()
or
1
if
sys
.
platform
==
'win32'
:
self
.
_max_workers
=
min
(
_MAX_WINDOWS_WORKERS
,
self
.
_max_workers
)
else
:
if
max_workers
<=
0
:
raise
ValueError
(
"max_workers must be greater than 0"
)
elif
(
sys
.
platform
==
'win32'
and
max_workers
>
_MAX_WINDOWS_WORKERS
):
raise
ValueError
(
f
"max_workers must be <= {_MAX_WINDOWS_WORKERS}"
)
self
.
_max_workers
=
max_workers
...
...
Lib/test/test_concurrent_futures.py
Dosyayı görüntüle @
39889864
...
...
@@ -755,6 +755,13 @@ class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, BaseTestCase):
class
ProcessPoolExecutorTest
(
ExecutorTest
):
@unittest.skipUnless
(
sys
.
platform
==
'win32'
,
'Windows-only process limit'
)
def
test_max_workers_too_large
(
self
):
with
self
.
assertRaisesRegex
(
ValueError
,
"max_workers must be <= 61"
):
futures
.
ProcessPoolExecutor
(
max_workers
=
62
)
def
test_killed_child
(
self
):
# When a child process is abruptly terminated, the whole pool gets
# "broken".
...
...
Misc/NEWS.d/next/Library/2019-05-06-19-17-04.bpo-26903.4payXb.rst
0 → 100644
Dosyayı görüntüle @
39889864
Limit `max_workers` in `ProcessPoolExecutor` to 61 to work around a WaitForMultipleObjects limitation.
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment