Chromium Code Reviews| Index: appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py |
| diff --git a/appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py b/appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py |
| index 912dd2f9df6762bd27efaabdfef46cbafdee0b65..a76dd70f30df6ad6fe5cfc14726e5a9019519539 100644 |
| --- a/appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py |
| +++ b/appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py |
| @@ -13,6 +13,31 @@ from waterfall.trigger_swarming_task_pipeline import TriggerSwarmingTaskPipeline |
| from waterfall.try_job_type import TryJobType |
| +_PRE_TEST_PREFIX = 'PRE_' |
| + |
| + |
| +def _RemoveAnyPrefixes(tests): |
| + """Remove prefixes from test names. |
| + |
| + Args: |
| + tests (list): A list of tests, eg: ['suite1.PRE_test1', 'suite2.test2']. |
| + |
| + Returns: |
| + base_tests (list): A list of base tests, eg: |
| + ['suite1.test1', 'suite2.test2']. |
| + """ |
| + base_tests = [] |
| + for test in tests: |
| + base_test = test |
| + pre_position = test.find(_PRE_TEST_PREFIX) |
|
stgao
2016/06/03 06:59:40
What if the test is "a_PRE_b.PRE_test"?
chanli
2016/06/06 22:41:29
Done.
|
| + while pre_position > -1: |
| + base_test = (base_test[: pre_position] + |
| + base_test[pre_position+len(_PRE_TEST_PREFIX):]) |
| + pre_position = base_test.find(_PRE_TEST_PREFIX) |
| + base_tests.append(base_test) |
| + return base_tests |
| + |
| + |
| class SwarmingTasksToTryJobPipeline(BasePipeline): |
| """Root Pipeline to start swarming tasks and possible try job on the build.""" |
| @@ -26,13 +51,18 @@ class SwarmingTasksToTryJobPipeline(BasePipeline): |
| # ProcessSwarmingTaskResultPipeline. |
| # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] |
| classified_tests_by_step = [] |
| + targeted_base_tests = {} |
| if try_job_type == TryJobType.TEST: |
| for step_name, tests in targeted_tests.iteritems(): |
| + base_tests = _RemoveAnyPrefixes(tests) |
| + targeted_base_tests[step_name] = base_tests |
| + |
| if not tests: # Skip non-swarming tests. |
| continue |
| + # Triggers swarming task for the base_tests. |
| task_id = yield TriggerSwarmingTaskPipeline( |
| - master_name, builder_name, build_number, step_name, tests) |
| + master_name, builder_name, build_number, step_name, base_tests) |
| step_future = yield ProcessSwarmingTaskResultPipeline( |
| master_name, builder_name, build_number, step_name, task_id) |
| logging_str = ( |
| @@ -44,5 +74,5 @@ class SwarmingTasksToTryJobPipeline(BasePipeline): |
| # Waits until classified_tests_by_step are ready. |
| yield RunTryJobForReliableFailurePipeline( |
| master_name, builder_name, build_number, good_revision, |
| - bad_revision, blame_list, try_job_type, compile_targets, targeted_tests, |
| - suspected_cls, *classified_tests_by_step) |
| + bad_revision, blame_list, try_job_type, compile_targets, |
| + targeted_base_tests, suspected_cls, *classified_tests_by_step) |