Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 datetime import datetime | 5 from datetime import datetime |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from common import appengine_util | 10 from common import appengine_util |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 suspected_tuples, output_nodes=None, failed_steps_and_tests=None): | 198 suspected_tuples, output_nodes=None, failed_steps_and_tests=None): |
| 199 new_group = WfFailureGroup.Create(master_name, builder_name, build_number) | 199 new_group = WfFailureGroup.Create(master_name, builder_name, build_number) |
| 200 new_group.build_failure_type = build_failure_type | 200 new_group.build_failure_type = build_failure_type |
| 201 new_group.blame_list = blame_list | 201 new_group.blame_list = blame_list |
| 202 new_group.suspected_tuples = suspected_tuples | 202 new_group.suspected_tuples = suspected_tuples |
| 203 new_group.output_nodes = output_nodes | 203 new_group.output_nodes = output_nodes |
| 204 new_group.failed_steps_and_tests = failed_steps_and_tests | 204 new_group.failed_steps_and_tests = failed_steps_and_tests |
| 205 new_group.put() | 205 new_group.put() |
| 206 | 206 |
| 207 | 207 |
| 208 def _GetMatchingGroup(wf_failure_groups, blame_list, suspected_tuples): | 208 def _GetMatchingGroup(wf_failure_groups, blame_list, suspected_tuples): |
|
lijeffrey
2016/07/27 22:49:36
a change like this is better tested with unit test
josiahk
2016/07/30 00:21:11
Thanks! I changed the code to use lists instead of
| |
| 209 # Tuples get turned into lists with ndb.JsonProperty. WfFailureGroup uses | |
| 210 # ndb.JsonProperty to store suspected_tuples. | |
| 211 suspected_tuples = [list(tup) for tup in suspected_tuples] | |
|
chanli
2016/07/28 17:40:25
Instead of modifying it here, you can just change
josiahk
2016/07/30 00:21:10
Thank you. I changed GenPotentialCulpritTupleList
| |
| 209 for group in wf_failure_groups: | 212 for group in wf_failure_groups: |
| 210 if _BlameListsIntersection(group.blame_list, blame_list): | 213 if _BlameListsIntersection(group.blame_list, blame_list): |
| 211 if suspected_tuples == group.suspected_tuples: | 214 if suspected_tuples == group.suspected_tuples: |
| 212 return group | 215 return group |
| 213 | 216 |
| 214 return None | 217 return None |
| 215 | 218 |
| 219 | |
| 216 def _GetOutputNodes(signals): | 220 def _GetOutputNodes(signals): |
| 217 if not signals or 'compile' not in signals: | 221 if not signals or 'compile' not in signals: |
| 218 return [] | 222 return [] |
| 219 | 223 |
| 220 # Compile failures with no output nodes will be considered unique. | 224 # Compile failures with no output nodes will be considered unique. |
| 221 return signals['compile'].get('failed_output_nodes', []) | 225 return signals['compile'].get('failed_output_nodes', []) |
| 222 | 226 |
| 223 | 227 |
| 224 def _GetMatchingCompileFailureGroups(output_nodes): | 228 def _GetMatchingCompileFailureGroups(output_nodes): |
| 225 # Output nodes should already be unique and sorted. | 229 # Output nodes should already be unique and sorted. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 return True | 263 return True |
| 260 | 264 |
| 261 suspected_tuples = sorted(GenPotentialCulpritTupleList(heuristic_result)) | 265 suspected_tuples = sorted(GenPotentialCulpritTupleList(heuristic_result)) |
| 262 existing_group = _GetMatchingGroup(groups, blame_list, suspected_tuples) | 266 existing_group = _GetMatchingGroup(groups, blame_list, suspected_tuples) |
| 263 | 267 |
| 264 # Create a new WfFailureGroup if we've encountered a unique build failure. | 268 # Create a new WfFailureGroup if we've encountered a unique build failure. |
| 265 if existing_group: | 269 if existing_group: |
| 266 logging.info('A group already exists, no need for a new try job.') | 270 logging.info('A group already exists, no need for a new try job.') |
| 267 _LinkAnalysisToBuildFailureGroup( | 271 _LinkAnalysisToBuildFailureGroup( |
| 268 master_name, builder_name, build_number, [existing_group.master_name, | 272 master_name, builder_name, build_number, [existing_group.master_name, |
| 269 existing_group.builder_name, existing_group.build_number]) | 273 existing_group.builder_name, |
| 274 existing_group.build_number]) | |
|
chanli
2016/07/28 17:40:26
Move the list to a separated line.
josiahk
2016/07/30 00:21:10
Thanks!
| |
| 270 else: | 275 else: |
| 271 logging.info('A new try job should be run for this unique build failure.') | 276 logging.info('A new try job should be run for this unique build failure.') |
| 272 _CreateBuildFailureGroup( | 277 _CreateBuildFailureGroup( |
| 273 master_name, builder_name, build_number, build_failure_type, blame_list, | 278 master_name, builder_name, build_number, build_failure_type, blame_list, |
| 274 suspected_tuples, output_nodes, failed_steps_and_tests) | 279 suspected_tuples, output_nodes, failed_steps_and_tests) |
| 275 _LinkAnalysisToBuildFailureGroup(master_name, builder_name, build_number, | 280 _LinkAnalysisToBuildFailureGroup(master_name, builder_name, build_number, |
| 276 [master_name, builder_name, build_number]) | 281 [master_name, builder_name, build_number]) |
| 277 | 282 |
| 278 return not existing_group | 283 return not existing_group |
| 279 | 284 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 pipeline.pipeline_status_path, try_job_type) | 435 pipeline.pipeline_status_path, try_job_type) |
| 431 else: # pragma: no cover | 436 else: # pragma: no cover |
| 432 logging_str = ( | 437 logging_str = ( |
| 433 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 438 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 434 'failure.') % ( | 439 'failure.') % ( |
| 435 master_name, builder_name, build_number, | 440 master_name, builder_name, build_number, |
| 436 pipeline.pipeline_status_path, try_job_type) | 441 pipeline.pipeline_status_path, try_job_type) |
| 437 logging.info(logging_str) | 442 logging.info(logging_str) |
| 438 | 443 |
| 439 return failure_result_map | 444 return failure_result_map |
| OLD | NEW |