setup.py 1010 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. def start(args, logfile, errfile):
  8. subprocess.check_call("nimrod c -d:release --path:../installs/jester/jester hello.nim", shell=True, cwd="jester", stderr=errfile, stdout=logfile)
  9. subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/jester/config/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
  10. for i in range(0, 8):
  11. subprocess.Popen("./hello 900" + str(i), shell=True, cwd="jester", stderr=errfile, stdout=logfile)
  12. return 0
  13. def stop(logfile, errfile):
  14. subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
  15. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  16. out, err = p.communicate()
  17. for line in out.splitlines():
  18. if 'hello' in line:
  19. try:
  20. pid = int(line.split(None, 2)[1])
  21. os.kill(pid, 15)
  22. except OSError:
  23. pass
  24. return 0