Skip to content

Commit

Permalink
remote process management updates in h2o-perf
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed Aug 5, 2014
1 parent 732fe11 commit 60b4998
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions h2o-perf/bench/py/h2oPerf/H2O.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,22 @@ def get_ticks(self):
if m != 0:
print "DEBUG: Restarting serve_proc!"
print "Stopping service"
cmd_serve = "ps -efww | grep 0xdiag | awk '{print %2}' | xargs kill"
tryKill = self.open_channel()
tryKill.exec_command(cmd_serve)
# cmd_serve = "ps -efww | grep 0xdiag | awk '{print %2}' | xargs kill"
# tryKill = self.open_channel()
# tryKill.exec_command(cmd_serve)

print "Starting service"
cmd_serve = ["python", "/home/0xdiag/serve_proc.py"]
self.channelServe = self.open_channel()
self.channelServe.exec_command(' '.join(cmd_serve))
# cmd_serve = ["python", "/home/0xdiag/serve_proc.py"]
# self.channelServe = self.open_channel()
# self.channelServe.exec_command(' '.join(cmd_serve))
r_sys = ""
r_proc = ""
print "Performing try : " + str(m) + " out of total tries = " + str(max_retries)
url_sys = "http://{}:{}/stat".format(self.ip, 8000)
url_proc = "http://{}:{}/{}/stat".format(self.ip, 8000, self.pid)
try:
r_sys = requests.get(url_sys, timeout=10).text.split('\n')[0]
r_proc = requests.get(url_proc, timeout=10).text.strip().split()
r_sys = requests.get(url_sys, timeout=5).text.split('\n')[0]
r_proc = requests.get(url_proc, timeout=5).text.strip().split()
except:
m += 1
continue # usually timeout, but just catch all and continue, error out downstream.
Expand Down Expand Up @@ -229,8 +229,8 @@ def get_ticks(self):

url_sys = "http://{}:{}/stat".format(self.ip, 8000)
url_proc = "http://{}:{}/{}/stat".format(self.ip, 8000, self.pid)
r_sys = requests.get(url_sys, timeout=120).text.split('\n')[0]
r_proc = requests.get(url_proc, timeout=120).text.strip().split()
r_sys = requests.get(url_sys, timeout=10).text.split('\n')[0]
r_proc = requests.get(url_proc, timeout=10).text.strip().split()

sys_user = int(r_sys.split()[1])
sys_nice = int(r_sys.split()[2])
Expand Down
30 changes: 15 additions & 15 deletions h2o-perf/bench/py/h2oPerf/Scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,21 @@ def invoke(self):
"""
self.insert_phase_result()
predict_type = ""
with open(self.output_file_name, "r") as f:
flag = False
for line in f:
if flag:
print "---------------------------------"
print line
print "---------------------------------"
predict_type = self.__get_predict_type__(line.strip())[0]
flag = False
break
if "PREDICT TYPE" in line and "print" not in line:
flag = True
self.result_type = predict_type
print "GOT RESULT TYPE: " + predict_type
self.__switch__()
# with open(self.output_file_name, "r") as f:
# flag = False
# for line in f:
# if flag:
# print "---------------------------------"
# print line
# print "---------------------------------"
# predict_type = self.__get_predict_type__(line.strip())[0]
# flag = False
# break
# if "PREDICT TYPE" in line and "print" not in line:
# flag = True
# self.result_type = predict_type
# print "GOT RESULT TYPE: " + predict_type
# self.__switch__()
return None

def insert_phase_result(self):
Expand Down

0 comments on commit 60b4998

Please sign in to comment.