mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-06 21:40:09 +03:00
environment based concurrency limit
This commit is contained in:
parent
955bfd47de
commit
c39de6d299
|
@ -7,6 +7,8 @@ virtualenv:
|
||||||
notifications:
|
notifications:
|
||||||
irc: "chat.freenode.net#pil"
|
irc: "chat.freenode.net#pil"
|
||||||
|
|
||||||
|
env: MAX_CONCURRENCY=4
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- 2.6
|
- 2.6
|
||||||
- 2.7
|
- 2.7
|
||||||
|
|
|
@ -106,7 +106,11 @@ def main():
|
||||||
|
|
||||||
files = filter_tests(files, python_options, tester_options)
|
files = filter_tests(files, python_options, tester_options)
|
||||||
|
|
||||||
pool = Pool()
|
try:
|
||||||
|
max_procs = int(os.environ.get('MAX_CONCURRENCY', cpu_count()))
|
||||||
|
except:
|
||||||
|
max_procs = None
|
||||||
|
pool = Pool(max_procs)
|
||||||
results = pool.map(test_one, files)
|
results = pool.map(test_one, files)
|
||||||
pool.close()
|
pool.close()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from multiprocessing import Pool, cpu_count
|
from multiprocessing import Pool, cpu_count
|
||||||
from distutils.ccompiler import CCompiler
|
from distutils.ccompiler import CCompiler
|
||||||
|
import os
|
||||||
|
|
||||||
# hideous monkeypatching. but. but. but.
|
# hideous monkeypatching. but. but. but.
|
||||||
def _mp_compile_one(tp):
|
def _mp_compile_one(tp):
|
||||||
|
@ -29,7 +30,12 @@ def _mp_compile(self, sources, output_dir=None, macros=None,
|
||||||
depends, extra_postargs)
|
depends, extra_postargs)
|
||||||
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
||||||
|
|
||||||
pool = Pool()
|
|
||||||
|
try:
|
||||||
|
max_procs = int(os.environ.get('MAX_CONCURRENCY', cpu_count()))
|
||||||
|
except:
|
||||||
|
max_procs = None
|
||||||
|
pool = Pool(max_procs)
|
||||||
try:
|
try:
|
||||||
print ("Building using %d processes" % pool._processes)
|
print ("Building using %d processes" % pool._processes)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user