setup_pypy.py 715 B

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