setup_unfiltered.py 847 B

123456789101112131415161718192021222324
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args):
  6. setup_util.replace_text("unfiltered/src/main/resources/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
  7. setup_util.replace_text("unfiltered/src/main/resources/application.conf", "{threads}", args.max_threads)
  8. subprocess.check_call("chmod u+x sbt", shell=True, cwd="unfiltered")
  9. subprocess.check_call("./sbt assembly", shell=True, cwd="unfiltered")
  10. subprocess.Popen("java -jar bench-assembly-1.0.0.jar", shell=True, cwd="unfiltered/target/scala-2.10")
  11. return 0
  12. def stop():
  13. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  14. out, err = p.communicate()
  15. for line in out.splitlines():
  16. if './start' in line or 'java' in line:
  17. pid = int(line.split(None, 2)[1])
  18. os.kill(pid, 9)
  19. return 0