| 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 collections import defaultdict | 5 from collections import defaultdict |
| 6 import copy | 6 import copy |
| 7 | 7 |
| 8 from handlers import result_status | 8 from handlers import result_status |
| 9 from model import wf_analysis_status | 9 from model import analysis_status |
| 10 from model.wf_analysis import WfAnalysis | 10 from model.wf_analysis import WfAnalysis |
| 11 from model.wf_swarming_task import WfSwarmingTask | 11 from model.wf_swarming_task import WfSwarmingTask |
| 12 from model.wf_try_job import WfTryJob | 12 from model.wf_try_job import WfTryJob |
| 13 from waterfall import buildbot | 13 from waterfall import buildbot |
| 14 from waterfall import waterfall_config | 14 from waterfall import waterfall_config |
| 15 | 15 |
| 16 | 16 |
| 17 def _GetFailureResultMap(master_name, builder_name, build_number): | 17 def _GetFailureResultMap(master_name, builder_name, build_number): |
| 18 analysis = WfAnalysis.Get(master_name, builder_name, build_number) | 18 analysis = WfAnalysis.Get(master_name, builder_name, build_number) |
| 19 if not analysis: | 19 if not analysis: |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 'try_job_key': 'm/b/121' | 291 'try_job_key': 'm/b/121' |
| 292 }, | 292 }, |
| 293 ... | 293 ... |
| 294 ] | 294 ] |
| 295 """ | 295 """ |
| 296 additional_flakiness_list = [] | 296 additional_flakiness_list = [] |
| 297 for try_job in try_jobs: | 297 for try_job in try_jobs: |
| 298 try_job_key = try_job['try_job_key'] | 298 try_job_key = try_job['try_job_key'] |
| 299 task = step_tasks_info.get('swarming_tasks', {}).get(try_job_key) | 299 task = step_tasks_info.get('swarming_tasks', {}).get(try_job_key) |
| 300 | 300 |
| 301 if task['task_info']['status'] != wf_analysis_status.ANALYZED: | 301 if task['task_info']['status'] != analysis_status.COMPLETED: |
| 302 # There is someting wrong with swarming task or it's not done yet, | 302 # There is someting wrong with swarming task or it's not done yet, |
| 303 # no try job yet or ever. | 303 # no try job yet or ever. |
| 304 try_job['status'] = result_status.NO_TRY_JOB_REASON_MAP[ | 304 try_job['status'] = result_status.NO_TRY_JOB_REASON_MAP[ |
| 305 task['task_info']['status']] | 305 task['task_info']['status']] |
| 306 try_job['tests'] = task.get('all_tests', []) | 306 try_job['tests'] = task.get('all_tests', []) |
| 307 else: | 307 else: |
| 308 # Swarming task is completed, group tests according to task result. | 308 # Swarming task is completed, group tests according to task result. |
| 309 try_job['ref_name'] = task['ref_name'] | 309 try_job['ref_name'] = task['ref_name'] |
| 310 if task.get('reliable_tests'): | 310 if task.get('reliable_tests'): |
| 311 try_job['tests'] = task['reliable_tests'] | 311 try_job['tests'] = task['reliable_tests'] |
| (...skipping 28 matching lines...) Expand all Loading... |
| 340 | 340 |
| 341 if isinstance(step_failure_result_map, dict): | 341 if isinstance(step_failure_result_map, dict): |
| 342 step_try_job_keys = set() | 342 step_try_job_keys = set() |
| 343 for try_job_key in step_failure_result_map.values(): | 343 for try_job_key in step_failure_result_map.values(): |
| 344 if try_job_key not in step_try_job_keys: | 344 if try_job_key not in step_try_job_keys: |
| 345 try_job_dict = { | 345 try_job_dict = { |
| 346 'try_job_key': try_job_key | 346 'try_job_key': try_job_key |
| 347 } | 347 } |
| 348 try_jobs.append(try_job_dict) | 348 try_jobs.append(try_job_dict) |
| 349 step_try_job_keys.add(try_job_key) | 349 step_try_job_keys.add(try_job_key) |
| 350 try_job_keys.update(step_try_job_keys) | 350 try_job_keys.update(step_try_job_keys) |
| 351 else: | 351 else: |
| 352 # Try job should only be triggered for swarming tests, because we cannot | 352 # Try job should only be triggered for swarming tests, because we cannot |
| 353 # identify flaky tests for non-swarming tests. | 353 # identify flaky tests for non-swarming tests. |
| 354 try_job_dict = { | 354 try_job_dict = { |
| 355 'try_job_key': step_failure_result_map | 355 'try_job_key': step_failure_result_map |
| 356 } | 356 } |
| 357 try_jobs.append(try_job_dict) | 357 try_jobs.append(try_job_dict) |
| 358 | 358 |
| 359 _UpdateTryJobInfoBasedOnSwarming(tasks_info[step_name], try_jobs) | 359 _UpdateTryJobInfoBasedOnSwarming(tasks_info[step_name], try_jobs) |
| 360 | 360 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 culprits_info[step_name] = { | 421 culprits_info[step_name] = { |
| 422 'try_jobs': [ | 422 'try_jobs': [ |
| 423 { | 423 { |
| 424 'status': result_status.NO_FAILURE_RESULT_MAP, | 424 'status': result_status.NO_FAILURE_RESULT_MAP, |
| 425 'tests': tests | 425 'tests': tests |
| 426 } | 426 } |
| 427 ] | 427 ] |
| 428 } | 428 } |
| 429 return culprits_info | 429 return culprits_info |
| OLD | NEW |