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

Unified Diff: appengine/chromium_try_flakes/handlers/all_flake_occurrences.py

Issue 1945903004: Add show-all feature to the all-flake-occurrences page (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@deprecate_bug_friendly
Patch Set: Fix Created 4 years, 7 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 | appengine/chromium_try_flakes/templates/all_flake_occurrences.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
diff --git a/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py b/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
index d36d38811bd98d542c5a05fc0da62e3207767e3c..ac6408233562c45e74b11aac74b34ed3bc0e1b01 100644
--- a/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
+++ b/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
@@ -14,6 +14,7 @@ import webapp2
MAX_GROUP_DISTANCE = datetime.timedelta(days=3)
+MAX_OCCURRENCES_WITHOUT_SHOW_ALL = 50
shishkander 2016/05/06 21:41:09 suggestion: MAX_OCCURRENCES_BY_DEFAULT = 50
Sergiy Byelozyorov 2016/05/06 21:55:09 Done.
def RunsSortFunction(s): # pragma: no cover
@@ -22,12 +23,12 @@ def RunsSortFunction(s): # pragma: no cover
def filterNone(elements):
return [e for e in elements if e is not None]
-def show_all_flakes(flake): # pragma: no cover
- occurrence_keys = []
- for o in flake.occurrences:
- occurrence_keys.append(o)
-
- occurrences = filterNone(ndb.get_multi(occurrence_keys))
+def show_all_flakes(flake, show_all): # pragma: no cover
+ if show_all:
+ occurrences = filterNone(ndb.get_multi(flake.occurrences))
+ else:
+ occurrences = filterNone(ndb.get_multi(
+ flake.occurrences[-MAX_OCCURRENCES_WITHOUT_SHOW_ALL:]))
shishkander 2016/05/06 21:41:09 suggestoion: from_index = 0 if show_all else -MAX_
Sergiy Byelozyorov 2016/05/06 21:55:09 Done.
failure_runs_keys = []
patchsets_keys = []
@@ -77,9 +78,12 @@ def show_all_flakes(flake): # pragma: no cover
current_group = [f]
grouped_runs.append(current_group)
+ show_all_link = (len(flake.occurrences) > MAX_OCCURRENCES_WITHOUT_SHOW_ALL and
+ not show_all)
values = {
'flake': flake,
'grouped_runs': grouped_runs,
+ 'show_all_link': show_all_link,
'time_now': datetime.datetime.utcnow(),
}
@@ -89,9 +93,10 @@ class AllFlakeOccurrences(webapp2.RequestHandler): # pragma: no cover
def get(self):
key = self.request.get('key')
flake = ndb.Key(urlsafe=key).get()
+ show_all = self.request.get('show_all', 0)
if not flake:
self.response.set_status(404, 'Flake with id %s does not exist' % key)
return
- self.response.write(show_all_flakes(flake))
+ self.response.write(show_all_flakes(flake, show_all))
« no previous file with comments | « no previous file | appengine/chromium_try_flakes/templates/all_flake_occurrences.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698