setup_pypy.py 620 B

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