Commit 29ea2a37 authored by Chong Zhang's avatar Chong Zhang Committed by Commit Bot

[Mojo FYI] Only merge common charts and points

'loading.desktop.network_service' fails randomly when uploading
json results, e.g.
https://ci.chromium.org/buildbot/chromium.perf.fyi/Mojo%20Linux%20Perf/5265

It seems that we might miss some charts in certain conditions.
e.g. We don't have 'timeToInteractive_std' when all values are None.

This CL handled the case by only doing diff on common charts / points
between control and enabled chartjson result.

Bug: 827442
Change-Id: Ibb1b9004d48bdfc2fa017c4acf57c989ae15c17f
Reviewed-on: https://chromium-review.googlesource.com/1003520Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Chong Zhang <chongz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549434}
parent 478049c6
......@@ -6,6 +6,7 @@ import copy
import json
import logging
import os
import traceback
from benchmarks import loading
......@@ -112,8 +113,16 @@ def _MergeControlChartJsonIntoEnabled(enabled_chart_json, control_chart_json):
control_charts = control_chart_json['charts']
diff_charts = copy.deepcopy(enabled_charts)
diff_charts['trace'] = {}
for chart_name in diff_charts:
for point_name in diff_charts[chart_name]:
for chart_name in diff_charts.keys():
if chart_name not in control_charts:
# Charts like 'timeToInteractive_std' may not be there if all values are
# None.
del diff_charts[chart_name]
continue
for point_name in diff_charts[chart_name].keys():
if point_name not in control_charts[chart_name]:
del diff_charts[chart_name][point_name]
continue
_PointSubtraction(diff_charts[chart_name][point_name],
control_charts[chart_name][point_name])
......@@ -165,18 +174,22 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop):
return enabled_return_code
enabled_chart_json = json.load(open(temp_file_path))
logging.info('Starting to merge control chartjson into enabled chartjson')
try:
# Merge the result and compute the difference.
_MergeControlChartJsonIntoEnabled(enabled_chart_json, control_chart_json)
except Exception as e:
logging.error('exception merging two chart json: %s', e)
logging.error('exception merging two chart json: %s', repr(e))
traceback.print_exc()
with open(temp_file_path, 'w') as f:
json.dump({
'control_chart_json': control_chart_json,
'enabled_chart_json': enabled_chart_json},
f, indent=2, separators=(',', ': '))
f.write('\n')
return 1
else:
logging.info('Finished merging chartjsons, writing back to disk')
with open(temp_file_path, 'w') as f:
json.dump(enabled_chart_json, f, indent=2, separators=(',', ': '))
f.write('\n')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment