| OLD | NEW |
| 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 from datetime import datetime | 6 from datetime import datetime |
| 7 | 7 |
| 8 from google.appengine.api import users | 8 from google.appengine.api import users |
| 9 | 9 |
| 10 from common import constants | 10 from common import constants |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 'suspected_cls': heuristic_result['suspected_cls'] | 246 'suspected_cls': heuristic_result['suspected_cls'] |
| 247 }, | 247 }, |
| 248 'tests': tests if tests != [NON_SWARMING] else [], | 248 'tests': tests if tests != [NON_SWARMING] else [], |
| 249 'first_failure': heuristic_result['first_failure'], | 249 'first_failure': heuristic_result['first_failure'], |
| 250 'last_pass': heuristic_result['last_pass'], | 250 'last_pass': heuristic_result['last_pass'], |
| 251 'supported': heuristic_result['supported'] | 251 'supported': heuristic_result['supported'] |
| 252 } | 252 } |
| 253 | 253 |
| 254 if (('status' not in try_job_result or | 254 if (('status' not in try_job_result or |
| 255 try_job_result['status'] in NO_TRY_JOB_REASON_MAP.values()) or | 255 try_job_result['status'] in NO_TRY_JOB_REASON_MAP.values()) or |
| 256 show_debug_info): | 256 try_job_result.get('can_force')): |
| 257 # There is no try job info but only heuristic result. | 257 # There is no try job info but only heuristic result. |
| 258 try_job_result['status'] = try_job_result.get( | 258 try_job_result['status'] = try_job_result.get( |
| 259 'status', result_status.UNKNOWN) | 259 'status', result_status.UNKNOWN) |
| 260 step_updated_results['unclassified_failures'].append(final_result) | 260 step_updated_results['unclassified_failures'].append(final_result) |
| 261 elif try_job_result['status'] == result_status.FLAKY: | 261 elif try_job_result['status'] == result_status.FLAKY: |
| 262 step_updated_results['flaky_failures'].append(final_result) | 262 step_updated_results['flaky_failures'].append(final_result) |
| 263 else: | 263 else: |
| 264 step_updated_results['reliable_failures'].append(final_result) | 264 step_updated_results['reliable_failures'].append(final_result) |
| 265 | 265 |
| 266 return updated_results | 266 return updated_results |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 show_debug_info=False): | 354 show_debug_info=False): |
| 355 data = self._PrepareCommonDataForFailure(analysis) | 355 data = self._PrepareCommonDataForFailure(analysis) |
| 356 data['status_message_map'] = result_status.STATUS_MESSAGE_MAP | 356 data['status_message_map'] = result_status.STATUS_MESSAGE_MAP |
| 357 | 357 |
| 358 organized_results = _GetOrganizedAnalysisResultBySuspectedCL( | 358 organized_results = _GetOrganizedAnalysisResultBySuspectedCL( |
| 359 analysis.result) | 359 analysis.result) |
| 360 analysis_result = _GetAnalysisResultWithTryJobInfo( | 360 analysis_result = _GetAnalysisResultWithTryJobInfo( |
| 361 show_debug_info, organized_results, *build_info) | 361 show_debug_info, organized_results, *build_info) |
| 362 | 362 |
| 363 data['analysis_result'] = analysis_result | 363 data['analysis_result'] = analysis_result |
| 364 | |
| 365 return data | 364 return data |
| 366 | 365 |
| 367 def HandleGet(self): | 366 def HandleGet(self): |
| 368 """Triggers analysis of a build failure on demand and return current result. | 367 """Triggers analysis of a build failure on demand and return current result. |
| 369 | 368 |
| 370 If the final analysis result is available, set cache-control to 1 day to | 369 If the final analysis result is available, set cache-control to 1 day to |
| 371 avoid overload by unnecessary and frequent query from clients; otherwise | 370 avoid overload by unnecessary and frequent query from clients; otherwise |
| 372 set cache-control to 5 seconds to allow repeated query. | 371 set cache-control to 5 seconds to allow repeated query. |
| 373 | 372 |
| 374 Serve HTML page or JSON result as requested. | 373 Serve HTML page or JSON result as requested. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 409 } |
| 411 else: | 410 else: |
| 412 return { | 411 return { |
| 413 'template': 'build_failure.html', | 412 'template': 'build_failure.html', |
| 414 'data': self._PrepareDataForTestFailures(analysis, build_info, | 413 'data': self._PrepareDataForTestFailures(analysis, build_info, |
| 415 self._ShowDebugInfo()), | 414 self._ShowDebugInfo()), |
| 416 } | 415 } |
| 417 | 416 |
| 418 def HandlePost(self): # pragma: no cover | 417 def HandlePost(self): # pragma: no cover |
| 419 return self.HandleGet() | 418 return self.HandleGet() |
| OLD | NEW |