setup_py3.py 868 B

12345678910111213141516171819202122232425262728293031323334
  1. import subprocess
  2. import setup_util
  3. import multiprocessing
  4. import os
  5. home = os.path.expanduser('~')
  6. bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py3/bin')
  7. NCPU = multiprocessing.cpu_count()
  8. proc = None
  9. def start(args):
  10. global proc
  11. setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
  12. setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu", home)
  13. proc = subprocess.Popen([
  14. bin_dir + "/gunicorn",
  15. "hello.wsgi:application",
  16. "-k", "meinheld.gmeinheld.MeinheldWorker",
  17. "-b", "0.0.0.0:8080",
  18. '-w', str(NCPU*3),
  19. "--log-level=critical"],
  20. cwd="django/hello")
  21. return 0
  22. def stop():
  23. global proc
  24. if proc is None:
  25. return 0
  26. proc.terminate()
  27. proc.wait()
  28. proc = None
  29. return 0