| 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 ( |
| 11 RunTryJobForReliableFailurePipeline) | 11 RunTryJobForReliableFailurePipeline) |
| 12 from waterfall.trigger_swarming_task_pipeline import TriggerSwarmingTaskPipeline | 12 from waterfall.trigger_swarming_task_pipeline import TriggerSwarmingTaskPipeline |
| 13 from waterfall.try_job_type import TryJobType | 13 from waterfall.try_job_type import TryJobType |
| 14 | 14 |
| 15 | 15 |
| 16 class SwarmingTasksToTryJobPipeline(BasePipeline): | 16 class SwarmingTasksToTryJobPipeline(BasePipeline): |
| 17 """Root Pipeline to start swarming tasks and possible try job on the build.""" | 17 """Root Pipeline to start swarming tasks and possible try job on the build.""" |
| 18 | 18 |
| 19 # Arguments number differs from overridden method - pylint: disable=W0221 | 19 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 20 def run( | 20 def run( |
| 21 self, master_name, builder_name, build_number, good_revision, | 21 self, master_name, builder_name, build_number, good_revision, |
| 22 bad_revision, blame_list, try_job_type, compile_targets=None, | 22 bad_revision, blame_list, try_job_type, compile_targets=None, |
| 23 targeted_tests=None, suspected_cls=None): | 23 targeted_tests=None, suspected_cls=None, force_try_job_rerun=False): |
| 24 | 24 |
| 25 # A list contains tuples of step_names and classified_tests from | 25 # A list contains tuples of step_names and classified_tests from |
| 26 # ProcessSwarmingTaskResultPipeline. | 26 # ProcessSwarmingTaskResultPipeline. |
| 27 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] | 27 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] |
| 28 classified_tests_by_step = [] | 28 classified_tests_by_step = [] |
| 29 | 29 |
| 30 if try_job_type == TryJobType.TEST: | 30 if try_job_type == TryJobType.TEST: |
| 31 for step_name, tests in targeted_tests.iteritems(): | 31 for step_name, tests in targeted_tests.iteritems(): |
| 32 if not tests: # Skip non-swarming tests. | 32 if not tests: # Skip non-swarming tests. |
| 33 continue | 33 continue |
| 34 task_id = yield TriggerSwarmingTaskPipeline( | 34 task_id = yield TriggerSwarmingTaskPipeline( |
| 35 master_name, builder_name, build_number, step_name, tests) | 35 master_name, builder_name, build_number, step_name, tests) |
| 36 step_future = yield ProcessSwarmingTaskResultPipeline( | 36 step_future = yield ProcessSwarmingTaskResultPipeline( |
| 37 master_name, builder_name, build_number, step_name, task_id) | 37 master_name, builder_name, build_number, step_name, task_id) |
| 38 logging_str = ( | 38 logging_str = ( |
| 39 'Swarming task was scheduled for build %s/%s/%s step %s') % ( | 39 'Swarming task was scheduled for build %s/%s/%s step %s') % ( |
| 40 master_name, builder_name, build_number, step_name) | 40 master_name, builder_name, build_number, step_name) |
| 41 logging.info(logging_str) | 41 logging.info(logging_str) |
| 42 classified_tests_by_step.append(step_future) | 42 classified_tests_by_step.append(step_future) |
| 43 | 43 |
| 44 # Waits until classified_tests_by_step are ready. | 44 # Waits until classified_tests_by_step are ready. |
| 45 yield RunTryJobForReliableFailurePipeline( | 45 yield RunTryJobForReliableFailurePipeline( |
| 46 master_name, builder_name, build_number, good_revision, | 46 master_name, builder_name, build_number, good_revision, |
| 47 bad_revision, blame_list, try_job_type, compile_targets, targeted_tests, | 47 bad_revision, blame_list, try_job_type, compile_targets, targeted_tests, |
| 48 suspected_cls, *classified_tests_by_step) | 48 suspected_cls, force_try_job_rerun, *classified_tests_by_step) |
| OLD | NEW |