OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Provides the web interface for a report on benchmark alert health.""" | 5 """Provides the web interface for a report on benchmark alert health.""" |
6 | 6 |
7 import datetime | 7 import datetime |
8 import json | 8 import json |
9 | 9 |
10 from dashboard import alerts | 10 from dashboard import alerts |
11 from dashboard import list_tests | 11 from dashboard import list_tests |
| 12 from dashboard import oauth2_decorator |
12 from dashboard import update_test_suites | 13 from dashboard import update_test_suites |
13 from dashboard.common import request_handler | 14 from dashboard.common import request_handler |
14 from dashboard.common import utils | 15 from dashboard.common import utils |
15 from dashboard.models import anomaly | 16 from dashboard.models import anomaly |
16 | 17 |
17 | 18 |
18 class BenchmarkHealthReportHandler(request_handler.RequestHandler): | 19 class BenchmarkHealthReportHandler(request_handler.RequestHandler): |
19 | 20 |
| 21 @oauth2_decorator.DECORATOR.oauth_required |
20 def get(self): | 22 def get(self): |
21 """Renders the UI for the group report page.""" | 23 """Renders the UI for the group report page.""" |
22 self.RenderStaticHtml('benchmark_health_report.html') | 24 self.RenderStaticHtml('benchmark_health_report.html') |
23 | 25 |
24 def post(self): | 26 def post(self): |
25 """Returns data about the alerts for a benchmark. | 27 """Returns data about the alerts for a benchmark. |
26 | 28 |
27 Request parameters: | 29 Request parameters: |
28 master: If specified, the master to list benchmarks for. If no arguments | 30 master: If specified, the master to list benchmarks for. If no arguments |
29 are specified, benchmarks will be listed for chromium.perf. | 31 are specified, benchmarks will be listed for chromium.perf. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 pattern, list_entities=True) | 82 pattern, list_entities=True) |
81 return monitored_tests[0].sheriff | 83 return monitored_tests[0].sheriff |
82 | 84 |
83 def _BenchmarkName(self, alert): | 85 def _BenchmarkName(self, alert): |
84 return utils.TestPath(alert.test).split('/')[2] | 86 return utils.TestPath(alert.test).split('/')[2] |
85 | 87 |
86 def _GetResponseValuesForMaster(self, master): | 88 def _GetResponseValuesForMaster(self, master): |
87 benchmarks = update_test_suites.FetchCachedTestSuites() | 89 benchmarks = update_test_suites.FetchCachedTestSuites() |
88 benchmarks = [b for b in benchmarks if master in benchmarks[b]['mas']] | 90 benchmarks = [b for b in benchmarks if master in benchmarks[b]['mas']] |
89 return {'benchmarks': sorted(benchmarks)} | 91 return {'benchmarks': sorted(benchmarks)} |
OLD | NEW |