setup_erlang.py 1.0 KB

12345678910111213141516171819202122
  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("rm -rf deps/*", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  8. subprocess.check_call("$IROOT/rebar/rebar get-deps", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  9. subprocess.check_call("$IROOT/rebar/rebar compile", shell=True, cwd="elli", stderr=errfile, stdout=logfile)
  10. # adding +K true seemed to actually slow performance
  11. 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)
  12. return 0
  13. except subprocess.CalledProcessError:
  14. return 1
  15. def stop(logfile, errfile):
  16. try:
  17. subprocess.check_call("killall beam.smp", shell=True, cwd="/usr/bin", stderr=errfile, stdout=logfile)
  18. return 0
  19. except subprocess.CalledProcessError:
  20. return 1