mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge branch 'master' of github.com:yandex/ClickHouse into errorcodes-style
This commit is contained in:
commit
ea15efc636
@ -76,8 +76,8 @@ def run_single_test(args, ext, server_logs_level, client_options, case_file, std
|
|||||||
total_time = (datetime.now() - start_time).total_seconds()
|
total_time = (datetime.now() - start_time).total_seconds()
|
||||||
|
|
||||||
# Normalize randomized database names in stdout, stderr files.
|
# Normalize randomized database names in stdout, stderr files.
|
||||||
os.system("sed -i -e 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stdout_file))
|
os.system("LC_ALL=C sed -i -e 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stdout_file))
|
||||||
os.system("sed -i -e 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stderr_file))
|
os.system("LC_ALL=C sed -i -e 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stderr_file))
|
||||||
|
|
||||||
stdout = open(stdout_file, 'r').read() if os.path.exists(stdout_file) else ''
|
stdout = open(stdout_file, 'r').read() if os.path.exists(stdout_file) else ''
|
||||||
stdout = unicode(stdout, errors='replace', encoding='utf-8')
|
stdout = unicode(stdout, errors='replace', encoding='utf-8')
|
||||||
|
@ -4,8 +4,13 @@ import collections
|
|||||||
import csv
|
import csv
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
doc_template = """
|
report_errors = []
|
||||||
|
status = 'success'
|
||||||
|
message = 'See the report'
|
||||||
|
|
||||||
|
print("""
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<style>
|
<style>
|
||||||
@ -38,24 +43,14 @@ p.links a {{ padding: 5px; margin: 3px; background: #FFF; line-height: 2; white-
|
|||||||
}}
|
}}
|
||||||
tr:nth-child(odd) td {{filter: brightness(95%);}}
|
tr:nth-child(odd) td {{filter: brightness(95%);}}
|
||||||
</style>
|
</style>
|
||||||
<title>{header}</title>
|
<title>Clickhouse performance comparison</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|
||||||
<h1>{header}</h1>
|
<h1>ClickHouse performance comparison</h1>
|
||||||
{test_part}
|
""".format())
|
||||||
<p class="links">
|
|
||||||
<a href="{raw_log_url}">{raw_log_name}</a>
|
|
||||||
<a href="{branch_url}">{branch_name}</a>
|
|
||||||
<a href="{commit_url}">Commit</a>
|
|
||||||
{additional_urls}
|
|
||||||
<a href="output.7z">Test output</a>
|
|
||||||
<a href="{task_url}">Task (private network)</a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
table_template = """
|
table_template = """
|
||||||
<h2 id="{anchor}"><a class="cancela" href="#{anchor}">{caption}</a></h2>
|
<h2 id="{anchor}"><a class="cancela" href="#{anchor}">{caption}</a></h2>
|
||||||
@ -84,74 +79,138 @@ def tr(x):
|
|||||||
#return '<tr onclick="location.href=\'#{a}\'" id={a}>{x}</tr>'.format(a=a, x=str(x))
|
#return '<tr onclick="location.href=\'#{a}\'" id={a}>{x}</tr>'.format(a=a, x=str(x))
|
||||||
return '<tr id={a}>{x}</tr>'.format(a=a, x=str(x))
|
return '<tr id={a}>{x}</tr>'.format(a=a, x=str(x))
|
||||||
|
|
||||||
def td(x):
|
def td(value, cell_class = ''):
|
||||||
return '<td>' + str(x) + '</td>'
|
return '<td class="{cell_class}">{value}</td>'.format(
|
||||||
|
cell_class = cell_class,
|
||||||
|
value = value)
|
||||||
|
|
||||||
def th(x):
|
def th(x):
|
||||||
return '<th>' + str(x) + '</th>'
|
return '<th>' + str(x) + '</th>'
|
||||||
|
|
||||||
def table_row(r):
|
def tableRow(r):
|
||||||
return tr(''.join([td(f) for f in r]))
|
return tr(''.join([td(f) for f in r]))
|
||||||
|
|
||||||
def table_header(r):
|
def tableHeader(r):
|
||||||
return tr(''.join([th(f) for f in r]))
|
return tr(''.join([th(f) for f in r]))
|
||||||
|
|
||||||
def tsv_rows(n):
|
def tableStart(title):
|
||||||
|
return """
|
||||||
|
<h2 id="{anchor}"><a class="cancela" href="#{anchor}">{title}</a></h2>
|
||||||
|
<table>""".format(
|
||||||
|
anchor = nextTableAnchor(),
|
||||||
|
title = title)
|
||||||
|
|
||||||
|
def tableEnd():
|
||||||
|
return '</table>'
|
||||||
|
|
||||||
|
def tsvRowsRaw(n):
|
||||||
|
result = []
|
||||||
|
try:
|
||||||
|
with open(n, encoding='utf-8') as fd:
|
||||||
|
return [row for row in csv.reader(fd, delimiter="\t", quotechar='"')]
|
||||||
|
except:
|
||||||
|
report_errors.append(
|
||||||
|
traceback.format_exception_only(
|
||||||
|
*sys.exc_info()[:2])[-1])
|
||||||
|
pass
|
||||||
|
return []
|
||||||
|
|
||||||
|
def tsvTableRows(n):
|
||||||
|
rawRows = tsvRowsRaw(n)
|
||||||
result = ''
|
result = ''
|
||||||
with open(n, encoding='utf-8') as fd:
|
for row in rawRows:
|
||||||
for row in csv.reader(fd, delimiter="\t", quotechar='"'):
|
result += tableRow(row)
|
||||||
result += table_row(row)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
params = collections.defaultdict(str)
|
print(table_template.format(
|
||||||
params['header'] = "ClickHouse Performance Comparison"
|
|
||||||
params['test_part'] = (
|
|
||||||
table_template.format(
|
|
||||||
anchor = nextTableAnchor(),
|
anchor = nextTableAnchor(),
|
||||||
caption = 'Tested commits',
|
caption = 'Tested commits',
|
||||||
header = table_header(['Old', 'New']),
|
header = tableHeader(['Old', 'New']),
|
||||||
rows = table_row([open('left-commit.txt').read(), open('right-commit.txt').read()])
|
rows = tableRow([open('left-commit.txt').read(), open('right-commit.txt').read()])))
|
||||||
) +
|
|
||||||
table_template.format(
|
print(table_template.format(
|
||||||
anchor = nextTableAnchor(),
|
anchor = nextTableAnchor(),
|
||||||
caption = 'Changes in performance',
|
caption = 'Changes in performance',
|
||||||
header = table_header(['Old, s', 'New, s',
|
header = tableHeader(['Old, s', 'New, s',
|
||||||
'Relative difference (new - old)/old',
|
'Relative difference (new - old)/old',
|
||||||
'Randomization distribution quantiles [5%, 50%, 95%]',
|
'Randomization distribution quantiles [5%, 50%, 95%]',
|
||||||
'Test', 'Query']),
|
'Test', 'Query']),
|
||||||
rows = tsv_rows('changed-perf.tsv')) +
|
rows = tsvTableRows('changed-perf.tsv')))
|
||||||
table_template.format(
|
|
||||||
anchor = nextTableAnchor(),
|
print(table_template.format(
|
||||||
caption = 'Slow on client',
|
anchor = nextTableAnchor(),
|
||||||
header = table_header(['Client time, s', 'Server time, s', 'Ratio', 'Query']),
|
caption = 'Slow on client',
|
||||||
rows = tsv_rows('slow-on-client.tsv')) +
|
header = tableHeader(['Client time, s', 'Server time, s', 'Ratio', 'Query']),
|
||||||
table_template.format(
|
rows = tsvTableRows('slow-on-client.tsv')))
|
||||||
anchor = nextTableAnchor(),
|
|
||||||
caption = 'Unstable queries',
|
print(table_template.format(
|
||||||
header = table_header(['Old, s', 'New, s',
|
anchor = nextTableAnchor(),
|
||||||
'Relative difference (new - old)/old',
|
caption = 'Unstable queries',
|
||||||
'Randomization distribution quantiles [5%, 50%, 95%]',
|
header = tableHeader(['Old, s', 'New, s',
|
||||||
'Test', 'Query']),
|
'Relative difference (new - old)/old',
|
||||||
rows = tsv_rows('unstable-queries.tsv')) +
|
'Randomization distribution quantiles [5%, 50%, 95%]',
|
||||||
table_template.format(
|
'Test', 'Query']),
|
||||||
anchor = nextTableAnchor(),
|
rows = tsvTableRows('unstable-queries.tsv')))
|
||||||
caption = 'Run errors',
|
|
||||||
header = table_header(['A', 'B']),
|
print(table_template.format(
|
||||||
rows = tsv_rows('run-errors.log')) +
|
anchor = nextTableAnchor(),
|
||||||
table_template.format(
|
caption = 'Run errors',
|
||||||
anchor = nextTableAnchor(),
|
header = tableHeader(['A', 'B']),
|
||||||
caption = 'Tests with most unstable queries',
|
rows = tsvTableRows('run-errors.log')))
|
||||||
header = table_header(['Test', 'Unstable', 'Changed perf', 'Total not OK']),
|
|
||||||
rows = tsv_rows('bad-tests.tsv')) +
|
print(table_template.format(
|
||||||
table_template.format(
|
anchor = nextTableAnchor(),
|
||||||
anchor = nextTableAnchor(),
|
caption = 'Tests with most unstable queries',
|
||||||
caption = 'Tests times',
|
header = tableHeader(['Test', 'Unstable', 'Changed perf', 'Total not OK']),
|
||||||
header = table_header(['Test', 'Wall clock time, s', 'Total client time, s',
|
rows = tsvTableRows('bad-tests.tsv')))
|
||||||
'Total queries',
|
|
||||||
'Ignored short queries',
|
def print_test_times():
|
||||||
'Longest query<br>(sum for all runs), s',
|
rows = tsvRowsRaw('test-times.tsv')
|
||||||
'Avg wall clock time<br>(sum for all runs), s',
|
if not rows:
|
||||||
'Shortest query<br>(sum for all runs), s']),
|
return
|
||||||
rows = tsv_rows('test-times.tsv'))
|
|
||||||
)
|
print(rows, file=sys.stderr)
|
||||||
print(doc_template.format_map(params))
|
|
||||||
|
print(tableStart('Test times'))
|
||||||
|
print(tableHeader([
|
||||||
|
'Test', #0
|
||||||
|
'Wall clock time, s', #1
|
||||||
|
'Total client time, s', #2
|
||||||
|
'Total queries', #3
|
||||||
|
'Ignored short queries', #4
|
||||||
|
'Longest query<br>(sum for all runs), s', #5
|
||||||
|
'Avg wall clock time<br>(sum for all runs), s', #6
|
||||||
|
'Shortest query<br>(sum for all runs), s', #7
|
||||||
|
]))
|
||||||
|
|
||||||
|
for r in rows:
|
||||||
|
print(tableRow(r))
|
||||||
|
|
||||||
|
print(tableEnd())
|
||||||
|
|
||||||
|
print_test_times()
|
||||||
|
|
||||||
|
if len(report_errors):
|
||||||
|
print(tableStart('Errors while building the report'))
|
||||||
|
print(tableHeader(['Error']))
|
||||||
|
for x in report_errors:
|
||||||
|
print(tableRow([x]))
|
||||||
|
print(tableEnd())
|
||||||
|
|
||||||
|
|
||||||
|
print("""
|
||||||
|
<p class="links">
|
||||||
|
<a href="output.7z">Test output</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""")
|
||||||
|
|
||||||
|
if report_errors:
|
||||||
|
status = 'error'
|
||||||
|
message = 'Errors while building the report.'
|
||||||
|
|
||||||
|
print("""
|
||||||
|
<!--status: {status}-->
|
||||||
|
<!--message: {message}-->
|
||||||
|
""".format(status=status, message=message))
|
||||||
|
Loading…
Reference in New Issue
Block a user