uwsgiconfig: permit to override CPUCOUNT with environment variable

CPUCOUNT=X make

will force X cores instead of the autodetected ones
This commit is contained in:
Riccardo Magliocchetti
2012-11-27 19:25:49 +01:00
parent 87ef444ea6
commit 4e119e6838
+10 -5
View File
@@ -33,15 +33,20 @@ if not GCC:
CPP = os.environ.get('CPP', 'cpp')
CPUCOUNT = 1
try:
import multiprocessing
CPUCOUNT = multiprocessing.cpu_count()
CPUCOUNT = int(os.environ.get('CPUCOUNT', -1))
except:
CPUCOUNT = -1
if CPUCOUNT < 1:
try:
CPUCOUNT = int(os.sysconf('SC_NPROCESSORS_ONLN'))
import multiprocessing
CPUCOUNT = multiprocessing.cpu_count()
except:
pass
try:
CPUCOUNT = int(os.sysconf('SC_NPROCESSORS_ONLN'))
except:
CPUCOUNT = 1
binary_list = []