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

Unified Diff: dashboard/dashboard/debug_alert.py

Issue 1549583002: In /graph_json, check internal_only on Test entity and skip test for all Row entities. (Closed) Base URL: https://github.com/catapult-project/catapult@master
Patch Set: Fixed assertions Created 5 years 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/datastore_hooks_test.py ('k') | dashboard/dashboard/debug_alert_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/debug_alert.py
diff --git a/dashboard/dashboard/debug_alert.py b/dashboard/dashboard/debug_alert.py
index be01cd98a28351ebe0c6ce79f84d04ffc6f53781..4b2596ac2101b10d9843b31cea99919580728365 100644
--- a/dashboard/dashboard/debug_alert.py
+++ b/dashboard/dashboard/debug_alert.py
@@ -7,6 +7,7 @@
import json
import urllib
+from dashboard import datastore_hooks
from dashboard import find_anomalies
from dashboard import find_change_points
from dashboard import request_handler
@@ -53,7 +54,7 @@ class DebugAlertHandler(request_handler.RequestHandler):
if revision:
rows = _FetchRowsAroundRev(test.key, int(revision), num_before, num_after)
else:
- rows = _FetchLatestRows(test.key, num_before)
+ rows = _FetchLatestRows(test, num_before)
chart_series = _ChartSeries(rows)
lookup = _RevisionList(rows)
@@ -236,19 +237,21 @@ def _RevisionList(rows):
return [r.revision for r in rows]
-def _FetchLatestRows(test_key, num_points):
+def _FetchLatestRows(test, num_points):
"""Does a query for the latest Row entities in the given test.
Args:
- test_key: A Test entity key to fetch Row entities for.
+ test: A Test entity to fetch Row entities for.
num_points: Number of points to fetch.
Returns:
A list of Row entities, ordered by revision. The number to fetch is limited
to the number that is expected to be processed at once by GASP.
"""
+ assert(utils.IsInternalUser() or not test.internal_only)
+ datastore_hooks.SetSinglePrivilegedRequest()
q = graph_data.Row.query(projection=['revision', 'value'])
- q = q.filter(graph_data.Row.parent_test == test_key)
+ q = q.filter(graph_data.Row.parent_test == test.key)
q = q.order(-graph_data.Row.revision)
rows = list(reversed(q.fetch(limit=num_points)))
return rows
@@ -329,4 +332,3 @@ def _GetDisplayBugId(bug_id):
"""Returns a display string for the given bug ID property of an anomaly."""
special_ids = {-1: 'INVALID', -2: 'IGNORE', None: 'NONE'}
return special_ids.get(bug_id, str(bug_id))
-
« no previous file with comments | « dashboard/dashboard/datastore_hooks_test.py ('k') | dashboard/dashboard/debug_alert_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698