| 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 logging | 6 import logging |
| 7 | 7 |
| 8 from common import appengine_util | 8 from common import appengine_util |
| 9 from model import wf_analysis_status | 9 from model import wf_analysis_status |
| 10 from model.wf_try_job import WfTryJob | 10 from model.wf_try_job import WfTryJob |
| 11 from pipeline_wrapper import BasePipeline | 11 from pipeline_wrapper import BasePipeline |
| 12 from pipeline_wrapper import pipeline | 12 from pipeline_wrapper import pipeline |
| 13 from waterfall import try_job_pipeline | 13 from waterfall import try_job_pipeline |
| 14 from waterfall.try_job_type import TryJobType | 14 from waterfall.try_job_type import TryJobType |
| 15 | 15 |
| 16 | 16 |
| 17 # TODO(chanli): Need to figure out why try-job-queue doesn't work. | 17 # TODO(chanli): Need to figure out why try-job-queue doesn't work. |
| 18 TRY_JOB_PIPELINE_QUEUE_NAME = 'build-failure-analysis-queue' | 18 TRY_JOB_PIPELINE_QUEUE_NAME = 'build-failure-analysis-queue' |
| 19 | 19 |
| 20 | 20 |
| 21 def _GetReliableTargetedTests(targeted_tests, classified_tests_by_step): | 21 def _GetReliableTargetedTests(targeted_tests, classified_tests_by_step): |
| 22 """Returns a dict containing a list of reliable tests for each failed step.""" | 22 """Returns a dict containing a list of reliable tests for each failed step.""" |
| 23 reliable_tests = defaultdict(list) | 23 reliable_tests = defaultdict(list) |
| 24 for step_name, tests in targeted_tests.iteritems(): | 24 for step_name, tests in targeted_tests.iteritems(): |
| 25 if step_name in classified_tests_by_step: # Swarming step. | 25 if step_name in classified_tests_by_step: # Swarming step. |
| 26 # If the step is swarming but there is no result for it, it's highly | 26 # If the step is swarming but there is no result for it, it's highly |
| 27 # likely that there is some error with the task. | 27 # likely that there is some error with the task. |
| 28 # Thus skip this step for no insights from task to avoid false positive. | 28 # Thus skip this step for no insights from task to avoid false positive. |
| 29 classified_tests = classified_tests_by_step[step_name] | 29 step_name_no_platform = classified_tests_by_step[step_name][0] |
| 30 classified_tests = classified_tests_by_step[step_name][1] |
| 31 |
| 30 for test in tests: | 32 for test in tests: |
| 31 if (test in classified_tests.get('reliable_tests', [])): | 33 if (test in classified_tests.get('reliable_tests', [])): |
| 32 reliable_tests[step_name].append(test) | 34 reliable_tests[step_name_no_platform].append(test) |
| 33 else: # Non-swarming step, includes it directly. | 35 else: # Non-swarming step, includes it directly. |
| 34 reliable_tests[step_name] = [] | 36 reliable_tests[step_name] = [] |
| 35 return reliable_tests | 37 return reliable_tests |
| 36 | 38 |
| 37 | 39 |
| 38 class RunTryJobForReliableFailurePipeline(BasePipeline): | 40 class RunTryJobForReliableFailurePipeline(BasePipeline): |
| 39 """A pipeline to trigger try job for reliable failures. | 41 """A pipeline to trigger try job for reliable failures. |
| 40 | 42 |
| 41 Processes result from SwarmingTaskPipeline and start TryJobPipeline if there | 43 Processes result from SwarmingTaskPipeline and start TryJobPipeline if there |
| 42 are reliable test failures. | 44 are reliable test failures. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 master_name, builder_name, build_number, | 81 master_name, builder_name, build_number, |
| 80 new_try_job_pipeline.pipeline_status_path) | 82 new_try_job_pipeline.pipeline_status_path) |
| 81 else: # pragma: no cover | 83 else: # pragma: no cover |
| 82 # No need to start try job, mark it as skipped. | 84 # No need to start try job, mark it as skipped. |
| 83 try_job_result = WfTryJob.Get( | 85 try_job_result = WfTryJob.Get( |
| 84 master_name, builder_name, build_number) | 86 master_name, builder_name, build_number) |
| 85 if try_job_result: | 87 if try_job_result: |
| 86 try_job_result.status = wf_analysis_status.SKIPPED | 88 try_job_result.status = wf_analysis_status.SKIPPED |
| 87 try_job_result.put() | 89 try_job_result.put() |
| 88 return | 90 return |
| OLD | NEW |