| 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 import logging | 5 import logging |
| 6 | 6 |
| 7 from common.pipeline_wrapper import BasePipeline | 7 from common.pipeline_wrapper import BasePipeline |
| 8 from waterfall.process_swarming_task_result_pipeline import ( | 8 from waterfall.process_swarming_task_result_pipeline import ( |
| 9 ProcessSwarmingTaskResultPipeline) | 9 ProcessSwarmingTaskResultPipeline) |
| 10 from waterfall.run_try_job_for_reliable_failure_pipeline import ( | 10 from waterfall.run_try_job_for_reliable_failure_pipeline import ( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return base_tests | 39 return base_tests |
| 40 | 40 |
| 41 | 41 |
| 42 class SwarmingTasksToTryJobPipeline(BasePipeline): | 42 class SwarmingTasksToTryJobPipeline(BasePipeline): |
| 43 """Root Pipeline to start swarming tasks and possible try job on the build.""" | 43 """Root Pipeline to start swarming tasks and possible try job on the build.""" |
| 44 | 44 |
| 45 # Arguments number differs from overridden method - pylint: disable=W0221 | 45 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 46 def run( | 46 def run( |
| 47 self, master_name, builder_name, build_number, good_revision, | 47 self, master_name, builder_name, build_number, good_revision, |
| 48 bad_revision, blame_list, try_job_type, compile_targets=None, | 48 bad_revision, blame_list, try_job_type, compile_targets=None, |
| 49 targeted_tests=None, suspected_cls=None): | 49 targeted_tests=None, suspected_cls=None, force_try_job=False): |
| 50 | 50 |
| 51 # A list contains tuples of step_names and classified_tests from | 51 # A list contains tuples of step_names and classified_tests from |
| 52 # ProcessSwarmingTaskResultPipeline. | 52 # ProcessSwarmingTaskResultPipeline. |
| 53 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] | 53 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] |
| 54 classified_tests_by_step = [] | 54 classified_tests_by_step = [] |
| 55 targeted_base_tests = {} | 55 targeted_base_tests = {} |
| 56 | 56 |
| 57 if try_job_type == TryJobType.TEST: | 57 if try_job_type == TryJobType.TEST: |
| 58 for step_name, tests in targeted_tests.iteritems(): | 58 for step_name, tests in targeted_tests.iteritems(): |
| 59 base_tests = _RemoveAnyPrefixes(tests) | 59 base_tests = _RemoveAnyPrefixes(tests) |
| 60 targeted_base_tests[step_name] = base_tests | 60 targeted_base_tests[step_name] = base_tests |
| 61 | 61 |
| 62 if not tests: # Skip non-swarming tests. | 62 if not tests: # Skip non-swarming tests. |
| 63 continue | 63 continue |
| 64 # Triggers swarming task for the base_tests. | 64 # Triggers swarming task for the base_tests. |
| 65 task_id = yield TriggerSwarmingTaskPipeline( | 65 task_id = yield TriggerSwarmingTaskPipeline( |
| 66 master_name, builder_name, build_number, step_name, base_tests) | 66 master_name, builder_name, build_number, step_name, base_tests) |
| 67 step_future = yield ProcessSwarmingTaskResultPipeline( | 67 step_future = yield ProcessSwarmingTaskResultPipeline( |
| 68 master_name, builder_name, build_number, step_name, task_id) | 68 master_name, builder_name, build_number, step_name, task_id) |
| 69 logging_str = ( | 69 logging_str = ( |
| 70 'Swarming task was scheduled for build %s/%s/%s step %s') % ( | 70 'Swarming task was scheduled for build %s/%s/%s step %s') % ( |
| 71 master_name, builder_name, build_number, step_name) | 71 master_name, builder_name, build_number, step_name) |
| 72 logging.info(logging_str) | 72 logging.info(logging_str) |
| 73 classified_tests_by_step.append(step_future) | 73 classified_tests_by_step.append(step_future) |
| 74 | 74 |
| 75 # Waits until classified_tests_by_step are ready. | 75 # Waits until classified_tests_by_step are ready. |
| 76 yield RunTryJobForReliableFailurePipeline( | 76 yield RunTryJobForReliableFailurePipeline( |
| 77 master_name, builder_name, build_number, good_revision, | 77 master_name, builder_name, build_number, good_revision, |
| 78 bad_revision, blame_list, try_job_type, compile_targets, | 78 bad_revision, blame_list, try_job_type, compile_targets, |
| 79 targeted_base_tests, suspected_cls, *classified_tests_by_step) | 79 targeted_base_tests, suspected_cls, force_try_job, |
| 80 *classified_tests_by_step) |
| OLD | NEW |