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

Unified Diff: dashboard/dashboard/benchmark_health_report.py

Issue 2707263008: benchmark_health_report: Query anomalies by benchmark/master. (Closed)
Patch Set: Filter out improvements 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dashboard/dashboard/benchmark_health_report_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/benchmark_health_report.py
diff --git a/dashboard/dashboard/benchmark_health_report.py b/dashboard/dashboard/benchmark_health_report.py
index f4a78f32702b37683942b2d144b0b6b2288307a6..8cf9520e0db78d6c902c767651122efef6aff9e1 100644
--- a/dashboard/dashboard/benchmark_health_report.py
+++ b/dashboard/dashboard/benchmark_health_report.py
@@ -8,10 +8,8 @@ import datetime
import json
from dashboard import alerts
-from dashboard import list_tests
from dashboard import update_test_suites
from dashboard.common import request_handler
-from dashboard.common import utils
from dashboard.models import anomaly
@@ -51,38 +49,23 @@ class BenchmarkHealthReportHandler(request_handler.RequestHandler):
values = {}
# The cached test suite info contains info about monitoring and bots.
+ query = anomaly.Anomaly.query(
+ anomaly.Anomaly.benchmark_name == benchmark,
+ anomaly.Anomaly.master_name == master,
+ anomaly.Anomaly.is_improvement == False,
+ anomaly.Anomaly.timestamp >
+ datetime.datetime.now() - datetime.timedelta(days=num_days))
+ query = query.order(-anomaly.Anomaly.timestamp)
+ anomalies = query.fetch()
+ values['alerts'] = alerts.AnomalyDicts(anomalies)
benchmarks = update_test_suites.FetchCachedTestSuites()
- sheriff = self._GetSheriffForBenchmark(benchmark, master, benchmarks)
- if sheriff:
- query = anomaly.Anomaly.query(anomaly.Anomaly.sheriff == sheriff)
- query = query.filter(anomaly.Anomaly.is_improvement == False)
- query = query.filter(
- anomaly.Anomaly.timestamp >
- datetime.datetime.now() - datetime.timedelta(days=num_days))
- query = query.order(-anomaly.Anomaly.timestamp)
- anomalies = query.fetch()
- anomalies = [a for a in anomalies if self._BenchmarkName(a) == benchmark]
+ if benchmarks[benchmark].get('mon'):
shatch 2017/02/23 15:58:30 nit: Is it possible to have alerts and not be moni
sullivan 2017/02/23 16:11:42 It is possible to have alerts and not be monitored
values['monitored'] = True
- values['alerts'] = alerts.AnomalyDicts(anomalies)
else:
values['monitored'] = False
-
values['bots'] = benchmarks[benchmark]['mas'][master].keys()
return values
- def _GetSheriffForBenchmark(self, benchmark, master, benchmarks):
- # TODO(sullivan): There can be multiple sheriffs; implement this.
- if not benchmarks[benchmark]['mon']:
- return None
- monitored_test_path = benchmarks[benchmark]['mon'][0]
- pattern = '%s/*/%s/%s' % (master, benchmark, monitored_test_path)
- monitored_tests = list_tests.GetTestsMatchingPattern(
- pattern, list_entities=True)
- return monitored_tests[0].sheriff
-
- def _BenchmarkName(self, alert):
- return utils.TestPath(alert.test).split('/')[2]
-
def _GetResponseValuesForMaster(self, master):
benchmarks = update_test_suites.FetchCachedTestSuites()
benchmarks = [b for b in benchmarks if master in benchmarks[b]['mas']]
« no previous file with comments | « no previous file | dashboard/dashboard/benchmark_health_report_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698