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

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

Issue 2086113004: [Findit] Show build analysis references in UI for Findit Cross-platform auto-triage (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@build-matching
Patch Set: Merged with ("rebased" on) Issue 2029873002's code. Other changes. Created 4 years, 5 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 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 logging 8 import logging
9 import os 9 import os
10 10
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 269
270 class BuildFailure(BaseHandler): 270 class BuildFailure(BaseHandler):
271 PERMISSION_LEVEL = Permission.ANYONE 271 PERMISSION_LEVEL = Permission.ANYONE
272 272
273 def _ShowDebugInfo(self): 273 def _ShowDebugInfo(self):
274 # Show debug info only if the app is run locally during development, if the 274 # Show debug info only if the app is run locally during development, if the
275 # currently logged-in user is an admin, or if it is explicitly requested 275 # currently logged-in user is an admin, or if it is explicitly requested
276 # with parameter 'debug=1'. 276 # with parameter 'debug=1'.
277 return ( 277 return (
278 users.is_current_user_admin() or self.request.get('debug') == '1') 278 users.is_current_user_admin() or self.request.get('debug') == '1')
chanli 2016/06/28 19:31:20 nit: could fit in one line
279 279
280 def _ShowTriageHelpButton(self): 280 def _ShowTriageHelpButton(self):
281 return users.is_current_user_admin() 281 return users.is_current_user_admin()
282 282
283 def _PrepareCommonDataForFailure(self, analysis): 283 def _PrepareCommonDataForFailure(self, analysis):
284 return { 284 return {
285 'master_name': analysis.master_name, 285 'master_name': analysis.master_name,
286 'builder_name': analysis.builder_name, 286 'builder_name': analysis.builder_name,
287 'build_number': analysis.build_number, 287 'build_number': analysis.build_number,
288 'pipeline_status_path': analysis.pipeline_status_path, 288 'pipeline_status_path': analysis.pipeline_status_path,
289 'show_debug_info': self._ShowDebugInfo(), 289 'show_debug_info': self._ShowDebugInfo(),
290 'analysis_request_time': _FormatDatetime(analysis.request_time), 290 'analysis_request_time': _FormatDatetime(analysis.request_time),
291 'analysis_start_time': _FormatDatetime(analysis.start_time), 291 'analysis_start_time': _FormatDatetime(analysis.start_time),
292 'analysis_end_time': _FormatDatetime(analysis.end_time), 292 'analysis_end_time': _FormatDatetime(analysis.end_time),
293 'analysis_duration': analysis.duration, 293 'analysis_duration': analysis.duration,
294 'analysis_update_time': _FormatDatetime(analysis.updated_time), 294 'analysis_update_time': _FormatDatetime(analysis.updated_time),
295 'analysis_completed': analysis.completed, 295 'analysis_completed': analysis.completed,
296 'analysis_failed': analysis.failed, 296 'analysis_failed': analysis.failed,
297 'analysis_correct': analysis.correct, 297 'analysis_correct': analysis.correct,
298 'analysis_is_duplicate': analysis.is_duplicate,
298 'triage_history': _GetTriageHistory(analysis), 299 'triage_history': _GetTriageHistory(analysis),
299 'show_triage_help_button': self._ShowTriageHelpButton(), 300 'show_triage_help_button': self._ShowTriageHelpButton(),
301 'triage_reference_analysis_master_name':
302 analysis.triage_reference_analysis_master_name,
303 'triage_reference_analysis_builder_name':
304 analysis.triage_reference_analysis_builder_name,
305 'triage_reference_analysis_build_number':
306 analysis.triage_reference_analysis_build_number
300 } 307 }
301 308
302 @staticmethod 309 @staticmethod
303 def _PrepareTryJobDataForCompileFailure(analysis): 310 def _PrepareTryJobDataForCompileFailure(analysis):
304 try_job_data = {} 311 try_job_data = {}
305 if not (analysis.failure_result_map and # pragma: no branch. 312 if not (analysis.failure_result_map and # pragma: no branch.
306 constants.COMPILE_STEP_NAME in analysis.failure_result_map): 313 constants.COMPILE_STEP_NAME in analysis.failure_result_map):
307 return try_job_data # pragma: no cover. 314 return try_job_data # pragma: no cover.
308 315
309 referred_build_keys = analysis.failure_result_map[ 316 referred_build_keys = analysis.failure_result_map[
310 constants.COMPILE_STEP_NAME].split('/') 317 constants.COMPILE_STEP_NAME].split('/')
311 try_job = WfTryJob.Get(*referred_build_keys) 318 try_job = WfTryJob.Get(*referred_build_keys)
312 if not try_job or not try_job.compile_results: 319 if not try_job or not try_job.compile_results:
313 return try_job_data # pragma: no cover. 320 return try_job_data # pragma: no cover.
314 result = try_job.compile_results[-1] 321 result = try_job.compile_results[-1]
315 322
316 try_job_data['status'] = analysis_status.STATUS_TO_DESCRIPTION.get( 323 try_job_data['status'] = analysis_status.STATUS_TO_DESCRIPTION.get(
317 try_job.status, 'unknown').lower() 324 try_job.status, 'unknown').lower()
318 try_job_data['url'] = result.get('url') 325 try_job_data['url'] = result.get('url')
319 try_job_data['completed'] = try_job.completed 326 try_job_data['completed'] = try_job.completed
320 try_job_data['failed'] = try_job.failed 327 try_job_data['failed'] = try_job.failed
321 try_job_data['culprit'] = result.get( 328 try_job_data['culprit'] = result.get(
322 'culprit', {}).get(constants.COMPILE_STEP_NAME) 329 'culprit', {}).get(constants.COMPILE_STEP_NAME)
323 330
324 return try_job_data 331 return try_job_data
325 332
326 @staticmethod 333 @staticmethod
327 def _PopulateHeuristicDataForCompileFailure(analysis, data): 334 def _PopulateHeuristicDataForCompileFailure(analysis, data):
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 self.request.get('force') == '1') 395 self.request.get('force') == '1')
389 build_completed = (users.is_current_user_admin() and 396 build_completed = (users.is_current_user_admin() and
390 self.request.get('build_completed') == '1') 397 self.request.get('build_completed') == '1')
391 analysis = build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded( 398 analysis = build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded(
392 master_name, builder_name, build_number, 399 master_name, builder_name, build_number,
393 build_completed=build_completed, force=force, 400 build_completed=build_completed, force=force,
394 queue_name=constants.WATERFALL_ANALYSIS_QUEUE) 401 queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
395 402
396 if analysis.failure_type == failure_type.COMPILE: 403 if analysis.failure_type == failure_type.COMPILE:
397 return { 404 return {
398 'template': 'waterfall/compile_failure.html', 405 'template': 'waterfall/compile_failure.html',
399 'data': self._PrepareDataForCompileFailure(analysis), 406 'data': self._PrepareDataForCompileFailure(analysis),
400 } 407 }
401 else: 408 else:
402 return { 409 return {
403 'template': 'build_failure.html', 410 'template': 'build_failure.html',
404 'data': self._PrepareDataForTestFailures(analysis, build_info), 411 'data': self._PrepareDataForTestFailures(analysis, build_info),
405 } 412 }
406 413
407 def HandlePost(self): # pragma: no cover 414 def HandlePost(self): # pragma: no cover
408 return self.HandleGet() 415 return self.HandleGet()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698