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..278f98b6b60cc1fa3b98d6700db7a931bd706749 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,32 @@ 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 |
| + test_name_start = test.find('.') if test.find('.') > -1 else 0 |
| + pre_position = test.find(_PRE_TEST_PREFIX, test_name_start) |
| + 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) |
|
stgao
2016/06/06 23:34:32
This seems incorrect.
To make it simpler, we coul
chanli
2016/06/08 21:10:59
Done.
|
| + 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 +52,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 +75,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) |