setup_py3.py 727 B

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