setup_py3.py 786 B

1234567891011121314151617181920212223242526272829303132333435
  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(
  12. "frameworkbenchmarks/models.py",
  13. "DBHOSTNAME = 'localhost'",
  14. "DBHOSTNAME = '%s'" % args.database_host
  15. )
  16. subprocess.call(bin_dir + '/pip install -e .', cwd='pyramid', shell=True)
  17. proc = subprocess.Popen([
  18. bin_dir + '/gunicorn',
  19. 'wsgi:app',
  20. '-b', "0.0.0.0:6543",
  21. '-w', str(NCPU*3)],
  22. cwd='pyramid'
  23. )
  24. return 0
  25. def stop():
  26. global proc
  27. if proc is not None:
  28. proc.terminate()
  29. proc.wait()
  30. return 0