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

Side by Side Diff: appengine/findit/handlers/flake/check_flake.py

Issue 2416303002: [Findit] Adding support for triaging suspected builds from flake analysis (Closed)
Patch Set: Rebase Created 4 years, 2 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from google.appengine.api import users
6
5 from common import auth_util 7 from common import auth_util
6 from common import constants 8 from common import constants
7 from common import time_util 9 from common import time_util
8 from common.base_handler import BaseHandler 10 from common.base_handler import BaseHandler
9 from common.base_handler import Permission 11 from common.base_handler import Permission
10 from model import analysis_status 12 from model import analysis_status
13 from model import triage_status
11 from waterfall.flake import initialize_flake_pipeline 14 from waterfall.flake import initialize_flake_pipeline
12 from waterfall.flake import triggering_sources 15 from waterfall.flake import triggering_sources
13 16
14 17
18 def _GetSuspectedFlakeAnalysisAndTriageResult(analysis):
19 if analysis.suspected_flake_build_number is not None:
20 return {
21 'build_number': analysis.suspected_flake_build_number,
22 'triage_result': (
23 analysis.triage_history[-1].triage_result if analysis.triage_history
24 else triage_status.UNTRIAGED)
25 }
26
27 return {}
28
29
15 class CheckFlake(BaseHandler): 30 class CheckFlake(BaseHandler):
16 PERMISSION_LEVEL = Permission.ANYONE 31 PERMISSION_LEVEL = Permission.ANYONE
17 32
18 def HandleGet(self): 33 def HandleGet(self):
19 master_name = self.request.get('master_name').strip() 34 master_name = self.request.get('master_name').strip()
20 builder_name = self.request.get('builder_name').strip() 35 builder_name = self.request.get('builder_name').strip()
21 build_number = int(self.request.get('build_number', '0').strip()) 36 build_number = int(self.request.get('build_number', '0').strip())
22 step_name = self.request.get('step_name').strip() 37 step_name = self.request.get('step_name').strip()
23 test_name = self.request.get('test_name').strip() 38 test_name = self.request.get('test_name').strip()
24 39
(...skipping 19 matching lines...) Expand all
44 'template': 'error.html', 59 'template': 'error.html',
45 'data': { 60 'data': {
46 'error_message': 61 'error_message':
47 ('You could schedule an analysis for flaky test only after ' 62 ('You could schedule an analysis for flaky test only after '
48 'you login with google.com account.'), 63 'you login with google.com account.'),
49 'login_url': self.GetLoginUrl(), 64 'login_url': self.GetLoginUrl(),
50 }, 65 },
51 'return_code': 401, 66 'return_code': 401,
52 } 67 }
53 68
69 suspected_flake = _GetSuspectedFlakeAnalysisAndTriageResult(analysis)
70
54 data = { 71 data = {
55 'pass_rates': [], 72 'pass_rates': [],
56 'analysis_status': analysis.status_description, 73 'analysis_status': analysis.status_description,
57 'suspected_flake_build_number': (
58 analysis.suspected_flake_build_number),
59 'master_name': master_name, 74 'master_name': master_name,
60 'builder_name': builder_name, 75 'builder_name': builder_name,
61 'build_number': build_number, 76 'build_number': build_number,
62 'step_name': step_name, 77 'step_name': step_name,
63 'test_name': test_name, 78 'test_name': test_name,
79 'version_number': analysis.version_number,
80 'suspected_flake': suspected_flake,
64 'request_time': time_util.FormatDatetime( 81 'request_time': time_util.FormatDatetime(
65 analysis.request_time), 82 analysis.request_time),
66 'task_number': len(analysis.data_points), 83 'task_number': len(analysis.data_points),
67 'error': analysis.error_message, 84 'error': analysis.error_message,
68 'iterations_to_rerun': analysis.iterations_to_rerun, 85 'iterations_to_rerun': analysis.iterations_to_rerun,
86 'show_debug_info': self._ShowDebugInfo()
69 } 87 }
70 88
89 if (users.is_current_user_admin() and analysis.completed and
90 analysis.triage_history):
91 data['triage_history'] = analysis.GetTriageHistory()
92
71 data['pending_time'] = time_util.FormatDuration( 93 data['pending_time'] = time_util.FormatDuration(
72 analysis.request_time, 94 analysis.request_time,
73 analysis.start_time or time_util.GetUTCNow()) 95 analysis.start_time or time_util.GetUTCNow())
74 if analysis.status != analysis_status.PENDING: 96 if analysis.status != analysis_status.PENDING:
75 data['duration'] = time_util.FormatDuration( 97 data['duration'] = time_util.FormatDuration(
76 analysis.start_time, 98 analysis.start_time,
77 analysis.end_time or time_util.GetUTCNow()) 99 analysis.end_time or time_util.GetUTCNow())
78 100
79 coordinates = [] 101 coordinates = []
80 for data_point in analysis.data_points: 102 for data_point in analysis.data_points:
81 coordinates.append([data_point.build_number, data_point.pass_rate]) 103 coordinates.append([data_point.build_number, data_point.pass_rate])
82 104
83 # Order by build number from earliest to latest. 105 # Order by build number from earliest to latest.
84 coordinates.sort(key=lambda x: x[0]) 106 coordinates.sort(key=lambda x: x[0])
85 107
86 data['pass_rates'] = coordinates 108 data['pass_rates'] = coordinates
87 return { 109 return {
88 'template': 'flake/result.html', 110 'template': 'flake/result.html',
89 'data': data 111 'data': data
90 } 112 }
OLDNEW
« no previous file with comments | « appengine/findit/handlers/build_failure.py ('k') | appengine/findit/handlers/flake/test/check_flake_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698