setup.py 758 B

12345678910111213141516171819202122232425
  1. import subprocess
  2. import setup_util
  3. from os.path import expanduser
  4. from os import kill
  5. python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
  6. cwd = expanduser('~/FrameworkBenchmarks/tornado')
  7. def start(args):
  8. setup_util.replace_text(
  9. cwd + "/server.py", "localhost", args.database_host)
  10. subprocess.Popen(
  11. python + " server.py --port=8080 --logging=error",
  12. shell=True, cwd=cwd)
  13. return 0
  14. def stop():
  15. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  16. out, err = p.communicate()
  17. for line in out.splitlines():
  18. if 'FrameworkBenchmarks/installs/py2/bin/python server.py --port=8080 --logging=error' in line:
  19. pid = int(line.split(None,2)[1])
  20. kill(pid, 9)
  21. return 0