setup.py 821 B

1234567891011121314151617181920212223242526272829303132
  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):
  9. setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
  10. setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu", home)
  11. proc = subprocess.Popen([
  12. bin_dir + "/gunicorn",
  13. "hello.wsgi:application",
  14. "-k", "meinheld.gmeinheld.MeinheldWorker",
  15. "-b", "0.0.0.0:8080",
  16. '-w', str(NCPU*3),
  17. "--log-level=critical"],
  18. cwd="django/hello")
  19. return 0
  20. def stop():
  21. global proc
  22. if proc is None:
  23. return 0
  24. proc.terminate()
  25. proc.wait()
  26. proc = None
  27. return 0