Skip to content

Commit

Permalink
uwsgiconfig: permit to override CPUCOUNT with environment variable
Browse files Browse the repository at this point in the history
CPUCOUNT=X make

will force X cores instead of the autodetected ones
  • Loading branch information
xrmx committed Nov 27, 2012
1 parent 87ef444 commit 4e119e6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions uwsgiconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@

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 = []

Expand Down

0 comments on commit 4e119e6

Please sign in to comment.