mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-05 04:50:09 +03:00
environment based concurrency limit
This commit is contained in:
parent
955bfd47de
commit
c39de6d299
|
@ -7,6 +7,8 @@ virtualenv:
|
|||
notifications:
|
||||
irc: "chat.freenode.net#pil"
|
||||
|
||||
env: MAX_CONCURRENCY=4
|
||||
|
||||
python:
|
||||
- 2.6
|
||||
- 2.7
|
||||
|
|
|
@ -106,7 +106,11 @@ def main():
|
|||
|
||||
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)
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
from multiprocessing import Pool, cpu_count
|
||||
from distutils.ccompiler import CCompiler
|
||||
import os
|
||||
|
||||
# hideous monkeypatching. but. but. but.
|
||||
def _mp_compile_one(tp):
|
||||
|
@ -28,8 +29,13 @@ def _mp_compile(self, sources, output_dir=None, macros=None,
|
|||
self._setup_compile(output_dir, macros, include_dirs, sources,
|
||||
depends, extra_postargs)
|
||||
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:
|
||||
print ("Building using %d processes" % pool._processes)
|
||||
except: pass
|
||||
|
|
Loading…
Reference in New Issue
Block a user