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
37cfb0a9
Kaydet (Commit)
37cfb0a9
authored
Haz 28, 2013
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17914: Use os.cpu_count() instead of multiprocessing.cpu_count() where
applicable.
üst
c723da36
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
13 deletions
+7
-13
multiprocessing.rst
Doc/library/multiprocessing.rst
+1
-1
process.py
Lib/concurrent/futures/process.py
+1
-1
pool.py
Lib/multiprocessing/pool.py
+3
-5
regrtest.py
Lib/test/regrtest.py
+2
-6
No files found.
Doc/library/multiprocessing.rst
Dosyayı görüntüle @
37cfb0a9
...
@@ -1664,7 +1664,7 @@ with the :class:`Pool` class.
...
@@ -1664,7 +1664,7 @@ with the :class:`Pool` class.
callbacks
and
has
a
parallel
map
implementation
.
callbacks
and
has
a
parallel
map
implementation
.
*
processes
*
is
the
number
of
worker
processes
to
use
.
If
*
processes
*
is
*
processes
*
is
the
number
of
worker
processes
to
use
.
If
*
processes
*
is
``
None
``
then
the
number
returned
by
:
func
:`
cpu_count
`
is
used
.
If
``
None
``
then
the
number
returned
by
:
func
:`
os
.
cpu_count
`
is
used
.
If
*
initializer
*
is
not
``
None
``
then
each
worker
process
will
call
*
initializer
*
is
not
``
None
``
then
each
worker
process
will
call
``
initializer
(*
initargs
)``
when
it
starts
.
``
initializer
(*
initargs
)``
when
it
starts
.
...
...
Lib/concurrent/futures/process.py
Dosyayı görüntüle @
37cfb0a9
...
@@ -331,7 +331,7 @@ class ProcessPoolExecutor(_base.Executor):
...
@@ -331,7 +331,7 @@ class ProcessPoolExecutor(_base.Executor):
_check_system_limits
()
_check_system_limits
()
if
max_workers
is
None
:
if
max_workers
is
None
:
self
.
_max_workers
=
multiprocessing
.
cpu_count
()
self
.
_max_workers
=
os
.
cpu_count
()
or
1
else
:
else
:
self
.
_max_workers
=
max_workers
self
.
_max_workers
=
max_workers
...
...
Lib/multiprocessing/pool.py
Dosyayı görüntüle @
37cfb0a9
...
@@ -17,10 +17,11 @@ import threading
...
@@ -17,10 +17,11 @@ import threading
import
queue
import
queue
import
itertools
import
itertools
import
collections
import
collections
import
os
import
time
import
time
import
traceback
import
traceback
from
multiprocessing
import
Process
,
cpu_count
,
TimeoutError
from
multiprocessing
import
Process
,
TimeoutError
from
multiprocessing.util
import
Finalize
,
debug
from
multiprocessing.util
import
Finalize
,
debug
#
#
...
@@ -147,10 +148,7 @@ class Pool(object):
...
@@ -147,10 +148,7 @@ class Pool(object):
self
.
_initargs
=
initargs
self
.
_initargs
=
initargs
if
processes
is
None
:
if
processes
is
None
:
try
:
processes
=
os
.
cpu_count
()
or
1
processes
=
cpu_count
()
except
NotImplementedError
:
processes
=
1
if
processes
<
1
:
if
processes
<
1
:
raise
ValueError
(
"Number of processes must be at least 1"
)
raise
ValueError
(
"Number of processes must be at least 1"
)
...
...
Lib/test/regrtest.py
Dosyayı görüntüle @
37cfb0a9
...
@@ -508,12 +508,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
...
@@ -508,12 +508,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
elif
o
in
(
'-j'
,
'--multiprocess'
):
elif
o
in
(
'-j'
,
'--multiprocess'
):
use_mp
=
int
(
a
)
use_mp
=
int
(
a
)
if
use_mp
<=
0
:
if
use_mp
<=
0
:
try
:
# Use all cores + extras for tests that like to sleep
import
multiprocessing
use_mp
=
2
+
(
os
.
cpu_count
()
or
1
)
# Use all cores + extras for tests that like to sleep
use_mp
=
2
+
multiprocessing
.
cpu_count
()
except
(
ImportError
,
NotImplementedError
):
use_mp
=
3
if
use_mp
==
1
:
if
use_mp
==
1
:
use_mp
=
None
use_mp
=
None
elif
o
==
'--header'
:
elif
o
==
'--header'
:
...
...
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