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

Unified Diff: dashboard/dashboard/models/anomaly.py

Issue 2627073006: Add a ref_test key to Anomaly entities and surface it in alerts JSON. (Closed)
Patch Set: Address review comments Created 3 years, 11 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 | « dashboard/dashboard/find_anomalies_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/models/anomaly.py
diff --git a/dashboard/dashboard/models/anomaly.py b/dashboard/dashboard/models/anomaly.py
index bc3e296855b78c2e0f19bff0f4d18eec85389c75..f1323398922fc9246533f4d11d47c3de048d88bc 100644
--- a/dashboard/dashboard/models/anomaly.py
+++ b/dashboard/dashboard/models/anomaly.py
@@ -8,6 +8,7 @@ import sys
from google.appengine.ext import ndb
+from dashboard.common import utils
from dashboard.models import alert
# A string to describe the magnitude of a change from zero to non-zero.
@@ -55,6 +56,9 @@ class Anomaly(alert.Alert):
# is a corresponding step up later on, or vice versa.)
recovered = ndb.BooleanProperty(indexed=True, default=False)
+ # If the TestMetadata alerted upon has a ref build, store the ref build.
+ ref_test = ndb.KeyProperty(indexed=False)
+
# The corresponding units from the TestMetaData entity.
units = ndb.StringProperty(indexed=False)
@@ -92,6 +96,11 @@ class Anomaly(alert.Alert):
else:
return '%f' % abs(self.absolute_delta)
+ def GetRefTestPath(self):
+ if not self.ref_test:
+ return None
+ return utils.TestPath(self.ref_test)
+
def SetIsImprovement(self, test=None):
"""Sets whether the alert is an improvement for the given test."""
if not test:
« no previous file with comments | « dashboard/dashboard/find_anomalies_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698