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

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

Issue 1866883002: [Findit] A huge refactoring and some bug fixing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. Created 4 years, 8 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 | « appengine/findit/findit_api.py ('k') | appengine/findit/handlers/check_duplicate_failures.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 collections import defaultdict 5 from collections import defaultdict
6 import copy 6 import copy
7 from datetime import datetime 7 from datetime import datetime
8 import os 8 import os
9 9
10 from google.appengine.api import users 10 from google.appengine.api import users
11 11
12 from base_handler import BaseHandler 12 from base_handler import BaseHandler
13 from base_handler import Permission 13 from base_handler import Permission
14 from common import constants
14 from handlers import handlers_util 15 from handlers import handlers_util
15 from handlers import result_status 16 from handlers import result_status
16 from handlers.result_status import NO_TRY_JOB_REASON_MAP 17 from handlers.result_status import NO_TRY_JOB_REASON_MAP
17 from model import wf_analysis_status 18 from model import analysis_status
18 from model.wf_analysis import WfAnalysis 19 from model.wf_analysis import WfAnalysis
19 from model.wf_analysis_result_status import RESULT_STATUS_TO_DESCRIPTION 20 from model.result_status import RESULT_STATUS_TO_DESCRIPTION
20 from waterfall import build_failure_analysis_pipelines 21 from waterfall import build_failure_analysis_pipelines
21 from waterfall import buildbot 22 from waterfall import buildbot
22 from waterfall import waterfall_config 23 from waterfall import waterfall_config
23 24
24 25
25 BUILD_FAILURE_ANALYSIS_TASKQUEUE = 'build-failure-analysis-queue'
26 NON_SWARMING = object() 26 NON_SWARMING = object()
27 27
28 28
29 def _FormatDatetime(dt): 29 def _FormatDatetime(dt):
30 if not dt: 30 if not dt:
31 return None 31 return None
32 else: 32 else:
33 return dt.strftime('%Y-%m-%d %H:%M:%S UTC') 33 return dt.strftime('%Y-%m-%d %H:%M:%S UTC')
34 34
35 35
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 { 155 {
156 # A dict of results that contains both 156 # A dict of results that contains both
157 # heuristic analysis results and try job results. 157 # heuristic analysis results and try job results.
158 'reliable_failures': { 158 'reliable_failures': {
159 'step1': { 159 'step1': {
160 'results': [ 160 'results': [
161 { 161 {
162 'try_job':{ 162 'try_job':{
163 'ref_name': 'step1', 163 'ref_name': 'step1',
164 'try_job_key': 'm/b/119', 164 'try_job_key': 'm/b/119',
165 'status': wf_analysis_status.ANALYZED, 165 'status': analysis_status.COMPLETED,
166 'try_job_url': 'url/121', 166 'try_job_url': 'url/121',
167 'try_job_build_number': 121, 167 'try_job_build_number': 121,
168 }, 168 },
169 'heuristic_analysis': { 169 'heuristic_analysis': {
170 'suspected_cls': [ 170 'suspected_cls': [
171 { 171 {
172 'build_number': 98, 172 'build_number': 98,
173 'repo_name': 'chromium', 173 'repo_name': 'chromium',
174 'revision': 'r98_1', 174 'revision': 'r98_1',
175 'commit_position': None, 175 'commit_position': None,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 if not analysis: 302 if not analysis:
303 # Only allow admin to force a re-run and set the build_completed. 303 # Only allow admin to force a re-run and set the build_completed.
304 force = (users.is_current_user_admin() and 304 force = (users.is_current_user_admin() and
305 self.request.get('force') == '1') 305 self.request.get('force') == '1')
306 build_completed = (users.is_current_user_admin() and 306 build_completed = (users.is_current_user_admin() and
307 self.request.get('build_completed') == '1') 307 self.request.get('build_completed') == '1')
308 analysis = build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded( 308 analysis = build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded(
309 master_name, builder_name, build_number, 309 master_name, builder_name, build_number,
310 build_completed=build_completed, force=force, 310 build_completed=build_completed, force=force,
311 queue_name=BUILD_FAILURE_ANALYSIS_TASKQUEUE) 311 queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
312 312
313 organized_results = _GetOrganizedAnalysisResultBySuspectedCL( 313 organized_results = _GetOrganizedAnalysisResultBySuspectedCL(
314 analysis.result) 314 analysis.result)
315 analysis_result = _GetAnalysisResultWithTryJobInfo( 315 analysis_result = _GetAnalysisResultWithTryJobInfo(
316 organized_results, *build_info) 316 organized_results, *build_info)
317 317
318 data = { 318 data = {
319 'master_name': analysis.master_name, 319 'master_name': analysis.master_name,
320 'builder_name': analysis.builder_name, 320 'builder_name': analysis.builder_name,
321 'build_number': analysis.build_number, 321 'build_number': analysis.build_number,
(...skipping 10 matching lines...) Expand all
332 'analysis_correct': analysis.correct, 332 'analysis_correct': analysis.correct,
333 'triage_history': _GetTriageHistory(analysis), 333 'triage_history': _GetTriageHistory(analysis),
334 'show_triage_help_button': self._ShowTriageHelpButton(), 334 'show_triage_help_button': self._ShowTriageHelpButton(),
335 'status_message_map': result_status.STATUS_MESSAGE_MAP 335 'status_message_map': result_status.STATUS_MESSAGE_MAP
336 } 336 }
337 337
338 return {'template': 'build_failure.html', 'data': data} 338 return {'template': 'build_failure.html', 'data': data}
339 339
340 def HandlePost(self): # pragma: no cover 340 def HandlePost(self): # pragma: no cover
341 return self.HandleGet() 341 return self.HandleGet()
OLDNEW
« no previous file with comments | « appengine/findit/findit_api.py ('k') | appengine/findit/handlers/check_duplicate_failures.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698