setup_pypy.py 743 B

12345678910111213141516171819202122232425262728293031
  1. import subprocess
  2. import os
  3. bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/pypy/bin')
  4. proc = None
  5. def start(args, logfile, errfile):
  6. global proc
  7. proc = subprocess.Popen([
  8. bin_dir + "/gunicorn",
  9. "app:app",
  10. "-c", "gunicorn_conf.py"],
  11. cwd="falcon", stderr=errfile, stdout=logfile)
  12. return 0
  13. def stop(logfile, errfile):
  14. global proc
  15. if proc:
  16. proc.terminate()
  17. proc = None
  18. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  19. out, err = p.communicate()
  20. for line in out.splitlines():
  21. if 'installs/pypy/bin/' in line:
  22. errfile.write("Killing: " + line + "\n")
  23. pid = int(line.split()[1])
  24. os.kill(pid, 15)
  25. return 0