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

Side by Side Diff: appengine/findit/handlers/culprit.py

Issue 2085513003: [Findit] Show the list of failed build cycles that a culprit is responsible for. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@group_same_failures
Patch Set: Add unittests. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | appengine/findit/handlers/test/culprit_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from google.appengine.ext import ndb
6
7 from common.base_handler import BaseHandler
8 from common.base_handler import Permission
9
10
11 def _FormatDatetime(dt):
12 if not dt:
13 return None # pragma: no cover
14 else:
15 return dt.strftime('%Y-%m-%d %H:%M:%S UTC')
16
17
18 class Culprit(BaseHandler):
19 PERMISSION_LEVEL = Permission.ANYONE
20
21 def HandleGet(self):
22 """Lists the build cycles in which the culprit caused failures."""
23 key = self.request.get('key', '')
24
25 culprit = ndb.Key(urlsafe=key).get()
26 if not culprit: # pragma: no cover
27 return self.CreateError('Culprit not found', 404)
28
29 def ConvertBuildInfoToADict(build_info):
30 return {
31 'master_name': build_info[0],
32 'builder_name': build_info[1],
33 'build_number': build_info[2],
34 }
35
36 data = {
37 'project_name': culprit.project_name,
38 'revision': culprit.revision,
39 'cr_notified': culprit.cr_notified,
40 'cr_notification_time': _FormatDatetime(culprit.cr_notification_time),
41 'builds': map(ConvertBuildInfoToADict, culprit.builds),
42 }
43 return {'template': 'waterfall/culprit.html', 'data': data}
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/handlers/test/culprit_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698