Skip to content
Snippets Groups Projects
Commit 466d8a6b authored by kpayson64's avatar kpayson64 Committed by GitHub
Browse files

Merge pull request #7465 from grpc/revert-6942-perf_html_report

Revert "Generate html report for perf tests"
parents 4f8c76d9 c23d33b2
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="en">
<head><title>Performance Test Result</title></head>
<body>
<h2>Performance Test Result</h2>
<table style="width:50%" border="1">
<% sorted_test_cases = sorted(resultset.keys()) %>
% for test_case in sorted_test_cases:
<tr><td bgcolor="#00BFFF" style="width:30%"><b>${test_case}</b></td>
<% result = resultset[test_case] %>
<td>
% for k, v in result.iteritems():
${k}: ${v}<br>
% endfor
</td>
</tr>
% endfor
</table>
</body>
</html>
...@@ -37,8 +37,6 @@ try: ...@@ -37,8 +37,6 @@ try:
from mako import exceptions from mako import exceptions
except (ImportError): except (ImportError):
pass # Mako not installed but it is ok. pass # Mako not installed but it is ok.
import glob
import json
import os import os
import string import string
import xml.etree.cElementTree as ET import xml.etree.cElementTree as ET
...@@ -122,38 +120,3 @@ def render_interop_html_report( ...@@ -122,38 +120,3 @@ def render_interop_html_report(
print(exceptions.text_error_template().render()) print(exceptions.text_error_template().render())
raise raise
def render_perf_html_report(report_dir):
"""Generate a simple HTML report for the perf tests."""
template_file = 'tools/run_tests/perf_html_report.template'
try:
mytemplate = Template(filename=template_file, format_exceptions=True)
except NameError:
print('Mako template is not installed. Skipping HTML report generation.')
return
except IOError as e:
print('Failed to find the template %s: %s' % (template_file, e))
return
resultset = {}
for result_file in glob.glob(os.path.join(report_dir, '*.json')):
with open(result_file, 'r') as f:
scenario_result = json.loads(f.read())
test_case = scenario_result['scenario']['name']
if 'ping_pong' in test_case:
latency50 = round(scenario_result['summary']['latency50'], 2)
latency99 = round(scenario_result['summary']['latency99'], 2)
summary = {'latency50': latency50, 'latency99': latency99}
else:
summary = {'qps': round(scenario_result['summary']['qps'], 2)}
resultset[test_case] = summary
args = {'resultset': resultset}
html_file_path = os.path.join(report_dir, 'index.html')
try:
with open(html_file_path, 'w') as output_file:
mytemplate.render_context(Context(output_file, **args))
except:
print(exceptions.text_error_template().render())
raise
...@@ -40,7 +40,6 @@ import multiprocessing ...@@ -40,7 +40,6 @@ import multiprocessing
import os import os
import pipes import pipes
import re import re
import report_utils
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
...@@ -55,7 +54,6 @@ os.chdir(_ROOT) ...@@ -55,7 +54,6 @@ os.chdir(_ROOT)
_REMOTE_HOST_USERNAME = 'jenkins' _REMOTE_HOST_USERNAME = 'jenkins'
_REPORT_DIR = 'perf_reports'
class QpsWorkerJob: class QpsWorkerJob:
...@@ -105,11 +103,7 @@ def create_scenario_jobspec(scenario_json, workers, remote_host=None, ...@@ -105,11 +103,7 @@ def create_scenario_jobspec(scenario_json, workers, remote_host=None,
cmd += 'BQ_RESULT_TABLE="%s" ' % bq_result_table cmd += 'BQ_RESULT_TABLE="%s" ' % bq_result_table
cmd += 'tools/run_tests/performance/run_qps_driver.sh ' cmd += 'tools/run_tests/performance/run_qps_driver.sh '
cmd += '--scenarios_json=%s ' % pipes.quote(json.dumps({'scenarios': [scenario_json]})) cmd += '--scenarios_json=%s ' % pipes.quote(json.dumps({'scenarios': [scenario_json]}))
if not os.path.isdir(_REPORT_DIR): cmd += '--scenario_result_file=scenario_result.json'
os.makedirs(_REPORT_DIR)
report_path = os.path.join(_REPORT_DIR,
'%s-scenario_result.json' % scenario_json['name'])
cmd += '--scenario_result_file=%s' % report_path
if remote_host: if remote_host:
user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host) user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host)
cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && "%s' % (user_at_host, pipes.quote(cmd)) cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && "%s' % (user_at_host, pipes.quote(cmd))
...@@ -442,9 +436,6 @@ try: ...@@ -442,9 +436,6 @@ try:
jobset.message('START', 'Running scenarios.', do_newline=True) jobset.message('START', 'Running scenarios.', do_newline=True)
num_failures, _ = jobset.run( num_failures, _ = jobset.run(
scenarios, newline_on_success=True, maxjobs=1) scenarios, newline_on_success=True, maxjobs=1)
report_utils.render_perf_html_report(_REPORT_DIR)
if num_failures == 0: if num_failures == 0:
jobset.message('SUCCESS', jobset.message('SUCCESS',
'All scenarios finished successfully.', 'All scenarios finished successfully.',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment