setup.py 986 B

12345678910111213141516171819202122232425262728293031
  1. import multiprocessing
  2. import subprocess
  3. import sys
  4. import setup_util
  5. import os
  6. import time
  7. uwsgi = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin/uwsgi')
  8. PROCS = multiprocessing.cpu_count()
  9. def start(args):
  10. # --http and --http-processes create http router processes that process the
  11. # incoming connections and pass them to the worker processes (-p). We use
  12. # PROCS number of http router processes so that a single router process
  13. # doesn't become a bottleneck.
  14. subprocess.Popen(
  15. uwsgi + ' --master -L -l 5000 --gevent 1000 --http :8080 --http-keepalive ' +
  16. ' --http-processes ' + str(PROCS) + ' -p ' + str(PROCS) + ' -w hello ' +
  17. ' --add-header "Connection: keep-alive" ' +
  18. ' --pidfile /tmp/uwsgi.pid',
  19. shell=True, cwd="uwsgi")
  20. return 0
  21. def stop():
  22. try:
  23. subprocess.Popen(uwsgi + ' --stop /tmp/uwsgi.pid', shell=True, cwd="uwsgi")
  24. except OSError:
  25. pass
  26. time.sleep(1)
  27. return 0