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

Unified Diff: dashboard/dashboard/graph_revisions.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: Removed purposeful fail for local debugging 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
Index: dashboard/dashboard/graph_revisions.py
diff --git a/dashboard/dashboard/graph_revisions.py b/dashboard/dashboard/graph_revisions.py
index 0aee43ef0dffac05b765d3590a26b2b616f4b8ca..0f8b13c71b9fdf6fcac6056ff553d390d5b39da8 100644
--- a/dashboard/dashboard/graph_revisions.py
+++ b/dashboard/dashboard/graph_revisions.py
@@ -78,10 +78,11 @@ def _UpdateCache(test_key):
Returns:
The list of triplets that was just fetched and set in the cache.
"""
- if not test_key.get():
- # The caching can actually proceed even if the Test entity doesn't exist,
- # but a non-existent Test entity definitely indicates something is wrong.
- logging.warn('Test not found: %s', utils.TestPath(test_key))
+ test = test_key.get()
+ if not test:
+ return
qyearsley 2015/12/28 22:50:56 Should we return [] here? Or explicitly return Non
sullivan 2015/12/29 03:36:07 I changed it to []
+ assert(utils.IsInternalUser() or not test.internal_only)
+ datastore_hooks.SetSinglePrivilegedRequest()
# A projection query queries just for the values of particular properties;
# this is faster than querying for whole entities.
@@ -90,6 +91,9 @@ def _UpdateCache(test_key):
# Using a large batch_size speeds up queries with > 1000 Rows.
rows = map(_MakeTriplet, query.iter(batch_size=1000))
+ # Note: Unit tests do not call datastore_hooks with the above query, but
+ # it is called in production and with more recent SDK.
+ datastore_hooks.CancelSinglePrivilegedRequest()
SetCache(utils.TestPath(test_key), rows)
return rows

Powered by Google App Engine
This is Rietveld 408576698