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

Unified Diff: dashboard/dashboard/find_anomalies.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/alerts_test.py ('k') | dashboard/dashboard/find_anomalies_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/find_anomalies.py
diff --git a/dashboard/dashboard/find_anomalies.py b/dashboard/dashboard/find_anomalies.py
index 7e36c8986e6bb8319e453c7e1cea0d0e33c0746e..2e7eb0bf3c68223fc0aa24016afd3b4beb5725fc 100644
--- a/dashboard/dashboard/find_anomalies.py
+++ b/dashboard/dashboard/find_anomalies.py
@@ -222,6 +222,26 @@ def _GetImmediatelyPreviousRevisionNumber(later_revision, rows):
assert False, 'No matching revision found in |rows|.'
+def _GetRefBuildKeyForTest(test):
+ """TestMetadata key of the reference build for the given test, if one exists.
+
+ Args:
+ test: the TestMetadata entity to get the ref build for.
+
+ Returns:
+ A TestMetadata key if found, or None if not.
+ """
+ potential_path = '%s/ref' % test.test_path
+ potential_test = utils.TestKey(potential_path).get()
+ if potential_test:
+ return potential_test.key
+ potential_path = '%s_ref' % test.test_path
+ potential_test = utils.TestKey(potential_path).get()
+ if potential_test:
+ return potential_test.key
+ return None
+
+
def _MakeAnomalyEntity(change_point, test, rows):
"""Creates an Anomaly entity.
@@ -250,6 +270,7 @@ def _MakeAnomalyEntity(change_point, test, rows):
degrees_of_freedom=change_point.degrees_of_freedom,
p_value=change_point.p_value,
is_improvement=_IsImprovement(test, median_before, median_after),
+ ref_test=_GetRefBuildKeyForTest(test),
test=test.key,
sheriff=test.sheriff,
internal_only=test.internal_only,
« no previous file with comments | « dashboard/dashboard/alerts_test.py ('k') | dashboard/dashboard/find_anomalies_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698