|
@@ -1,25 +1,29 @@
|
|
|
-from os.path import expanduser
|
|
|
-from os import kill
|
|
|
+import os
|
|
|
import subprocess
|
|
|
import sys
|
|
|
import time
|
|
|
|
|
|
|
|
|
-python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
|
|
|
-cwd = expanduser('~/FrameworkBenchmarks/tornado')
|
|
|
+bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
|
|
|
+python = os.path.expanduser(os.path.join(bin_dir, 'python'))
|
|
|
+pip = os.path.expanduser(os.path.join(bin_dir, 'pip'))
|
|
|
+cwd = os.path.expanduser('~/FrameworkBenchmarks/tornado')
|
|
|
|
|
|
|
|
|
def start(args, logfile, errfile):
|
|
|
+ subprocess.call(pip + ' install -r requirements.txt', cwd=cwd, shell=True, stderr=errfile, stdout=logfile)
|
|
|
+
|
|
|
subprocess.Popen(
|
|
|
- python + " server.py --port=8080 --postgres=%s --logging=error" % (args.database_host,),
|
|
|
+ python + ' server.py --port=8080 --postgres=%s --logging=error' % (args.database_host,),
|
|
|
shell=True, cwd=cwd, stderr=errfile, stdout=logfile)
|
|
|
return 0
|
|
|
|
|
|
+
|
|
|
def stop(logfile, errfile):
|
|
|
- for line in subprocess.check_output(["ps", "aux"]).splitlines():
|
|
|
+ for line in subprocess.check_output(['ps', 'aux']).splitlines():
|
|
|
if 'server.py --port=8080' in line:
|
|
|
- pid = int(line.split(None,2)[1])
|
|
|
- kill(pid, 9)
|
|
|
+ pid = int(line.split(None, 2)[1])
|
|
|
+ os.kill(pid, 9)
|
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|