setup.py 741 B

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