setup_erlang.py 954 B

123456789101112131415161718192021
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args, logfile, errfile):
  5. setup_util.replace_text("elli/src/elli_bench_sup.erl", "\"benchmarkdbpass\", \".*\", 3306", "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")
  6. try:
  7. subprocess.check_call("./rebar get-deps", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  8. subprocess.check_call("./rebar compile", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  9. # adding +K true seemed to actually slow performance
  10. subprocess.check_call("erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s elli_bench -noshell -detached", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop(logfile, errfile):
  15. try:
  16. subprocess.check_call("killall beam.smp", shell=True, cwd="/usr/bin", stderr=errfile, stdout=logfile)
  17. return 0
  18. except subprocess.CalledProcessError:
  19. return 1