setup.py 677 B

12345678910111213141516171819202122232425262728293031
  1. import subprocess
  2. import setup_util
  3. import multiprocessing
  4. import os
  5. bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
  6. NCPU = multiprocessing.cpu_count()
  7. proc = None
  8. def start(args, logfile, errfile):
  9. global proc
  10. proc = subprocess.Popen([
  11. bin_dir + "/gunicorn",
  12. "hello:app",
  13. "-k", "meinheld.gmeinheld.MeinheldWorker",
  14. "-b", "0.0.0.0:8080",
  15. '-w', str(NCPU),
  16. "--log-level=critical"],
  17. cwd="wsgi", stderr=errfile, stdout=logfile)
  18. return 0
  19. def stop(logfile, errfile):
  20. global proc
  21. if proc is None:
  22. return 0
  23. proc.terminate()
  24. proc.wait()
  25. proc = None
  26. return 0