| OLD | NEW |
| 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.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 | 6 |
| 7 from common import time_util | 7 from common import time_util |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model import analysis_approach_type | 9 from model import analysis_approach_type |
| 10 from model.wf_suspected_cl import WfSuspectedCL | 10 from model.wf_suspected_cl import WfSuspectedCL |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 for test in tests: | 114 for test in tests: |
| 115 if not test in new_failures[step]: # New test. | 115 if not test in new_failures[step]: # New test. |
| 116 return True | 116 return True |
| 117 | 117 |
| 118 return False | 118 return False |
| 119 | 119 |
| 120 | 120 |
| 121 def GetSuspectedCLConfidenceScoreAndApproach( | 121 def GetSuspectedCLConfidenceScoreAndApproach( |
| 122 confidences, cl_from_analyzed_build, cl_from_first_failed_build): | 122 confidences, cl_from_analyzed_build, cl_from_first_failed_build): |
| 123 if not confidences or not cl_from_analyzed_build: | 123 if not confidences or ( |
| 124 not cl_from_analyzed_build and not cl_from_first_failed_build): |
| 124 return None, None | 125 return None, None |
| 125 | 126 |
| 126 if (cl_from_first_failed_build and not _HasNewFailures( | 127 if (cl_from_first_failed_build and ( |
| 127 cl_from_analyzed_build.get('failures'), | 128 not cl_from_analyzed_build or |
| 128 cl_from_first_failed_build.get('failures'))): | 129 not _HasNewFailures(cl_from_analyzed_build.get('failures'), |
| 130 cl_from_first_failed_build.get('failures')))): |
| 129 # For non-first-time failures, the try job result is not recorded. | 131 # For non-first-time failures, the try job result is not recorded. |
| 130 # If there is no new failures in current build, use first failed build to | 132 # If there is no new failures in current build, use first failed build to |
| 131 # make sure the confidence score is correct. | 133 # make sure the confidence score is correct. |
| 132 cl_from_analyzed_build = cl_from_first_failed_build | 134 cl_from_analyzed_build = cl_from_first_failed_build |
| 133 | 135 |
| 134 confidence = GetSuspectedCLConfidenceScore( | 136 confidence = GetSuspectedCLConfidenceScore( |
| 135 confidences, cl_from_analyzed_build) | 137 confidences, cl_from_analyzed_build) |
| 136 approach = ( | 138 approach = ( |
| 137 analysis_approach_type.TRY_JOB if analysis_approach_type.TRY_JOB in | 139 analysis_approach_type.TRY_JOB if analysis_approach_type.TRY_JOB in |
| 138 cl_from_analyzed_build['approaches'] else | 140 cl_from_analyzed_build['approaches'] else |
| 139 analysis_approach_type.HEURISTIC) | 141 analysis_approach_type.HEURISTIC) |
| 140 | 142 |
| 141 return confidence, approach | 143 return confidence, approach |
| OLD | NEW |