Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: dashboard/dashboard/benchmark_quality_report.py

Issue 2704663003: First version of benchmark health report. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Provides the web interface for a report on benchmark alert quality."""
6
7 import datetime
8 import json
9
10 from dashboard import alerts
11 from dashboard import list_tests
12 from dashboard import update_test_suites
13 from dashboard.common import request_handler
14 from dashboard.common import utils
15 from dashboard.models import anomaly
16
17
18 class BenchmarkQualityReportHandler(request_handler.RequestHandler):
19 """Request handler for requests for group report page."""
20
21 def get(self):
22 """Renders the UI for the group report page."""
23 self.RenderStaticHtml('benchmark_quality_report.html')
24
25 def post(self):
26 """Returns data about the alerts for a benchmark.
27
28 Request parameters:
29 master: If specified, the master to list benchmarks for. If no arguments
30 are specified, benchmarks will be listed for chromium.perf.
31 benchmark: If specified, the name of the benchmark to gather details for.
32 num_days: With benchmark, number of days to get data for.
33 bug: If specified, the id of the bug to gather details for.
34
35 Outputs:
36 JSON for the /group_report page XHR request.
37 """
38 master = self.request.get('master')
39 benchmark = self.request.get('benchmark')
40 response_values = {}
41
42 if benchmark:
43 num_days = int(self.request.get('num_days'))
44 response_values = self._GetResponseValuesForBenchmark(
45 benchmark, num_days, master)
46 else:
47 response_values = self._GetResponseValuesForMaster(master)
sullivan 2017/02/17 16:30:13 Current style of the dashboard is to have differen
shatch 2017/02/17 18:03:47 sgtm
eakuefner 2017/02/17 19:11:05 Caveat that I'm having a little bit of trouble par
sullivan 2017/02/17 20:01:02 I've been meaning to write up a bug/doc for discus
48
49 self.response.out.write(json.dumps(response_values))
50
51 def _GetResponseValuesForBenchmark(self, benchmark, num_days, master):
52 values = {}
53
54 # The cached test suite info contains info about monitoring and bots.
55 benchmarks = update_test_suites.FetchCachedTestSuites()
56 sheriff = self._GetSheriffForBenchmark(benchmark, master, benchmarks)
57 if sheriff:
58 query = anomaly.Anomaly.query(anomaly.Anomaly.sheriff == sheriff)
59 query = query.filter(anomaly.Anomaly.is_improvement == False)
60 query = query.filter(
61 anomaly.Anomaly.timestamp >
62 datetime.datetime.now() - datetime.timedelta(days=num_days))
63 query = query.order(-anomaly.Anomaly.timestamp)
64 anomalies = query.fetch()
65 anomalies = [a for a in anomalies if self._BenchmarkName(a) == benchmark]
66 values['monitored'] = True
67 values['alerts'] = alerts.AnomalyDicts(anomalies)
68 else:
69 values['monitored'] = False
70
71 values['bots'] = benchmarks[benchmark]['mas'][master].keys()
72 return values
73
74 def _GetSheriffForBenchmark(self, benchmark, master, benchmarks):
sullivan 2017/02/17 16:30:13 This doesn't work if there are multiple sheriffs o
shatch 2017/02/17 18:03:47 Ah yeah was wondering why some of the pages return
sullivan 2017/02/17 18:28:42 Done.
75 if not benchmarks[benchmark]['mon']:
76 return None
77 monitored_test_path = benchmarks[benchmark]['mon'][0]
78 pattern = '%s/*/%s/%s' % (master, benchmark, monitored_test_path)
79 monitored_tests = list_tests.GetTestsMatchingPattern(
80 pattern, list_entities=True)
81 return monitored_tests[0].sheriff
82
83 def _BenchmarkName(self, alert):
84 return utils.TestPath(alert.test).split('/')[2]
85
86 def _GetResponseValuesForMaster(self, master):
87 benchmarks = update_test_suites.FetchCachedTestSuites()
sullivan 2017/02/17 16:30:13 We already have tons of information cached about t
shatch 2017/02/17 18:03:47 Hadn't seen this, didn't know how bad it was. Don'
sullivan 2017/02/17 18:28:43 Sounds good! This might turn into a good test case
eakuefner 2017/02/17 19:11:05 I agree with both of you, that this is a place whe
88 benchmarks = [b for b in benchmarks if master in benchmarks[b]['mas']]
89 return {'benchmarks': sorted(benchmarks)}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698