Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: appengine/findit/waterfall/swarming_tasks_to_try_job_pipeline.py

Issue 2027333002: [Findit] don't included skipped or unknown tests in swarming tasks into failed tests. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 _PRE_TEST_PREFIX = 'PRE_'
17
18
19 def _RemoveAnyPrefixes(tests):
20 """Remove prefixes from test names.
21
22 Args:
23 tests (list): A list of tests, eg: ['suite1.PRE_test1', 'suite2.test2'].
24
25 Returns:
26 base_tests (list): A list of base tests, eg:
27 ['suite1.test1', 'suite2.test2'].
28 """
29 base_tests = []
30 for test in tests:
31 base_test = test
32 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.
33 while pre_position > -1:
34 base_test = (base_test[: pre_position] +
35 base_test[pre_position+len(_PRE_TEST_PREFIX):])
36 pre_position = base_test.find(_PRE_TEST_PREFIX)
37 base_tests.append(base_test)
38 return base_tests
39
40
16 class SwarmingTasksToTryJobPipeline(BasePipeline): 41 class SwarmingTasksToTryJobPipeline(BasePipeline):
17 """Root Pipeline to start swarming tasks and possible try job on the build.""" 42 """Root Pipeline to start swarming tasks and possible try job on the build."""
18 43
19 # Arguments number differs from overridden method - pylint: disable=W0221 44 # Arguments number differs from overridden method - pylint: disable=W0221
20 def run( 45 def run(
21 self, master_name, builder_name, build_number, good_revision, 46 self, master_name, builder_name, build_number, good_revision,
22 bad_revision, blame_list, try_job_type, compile_targets=None, 47 bad_revision, blame_list, try_job_type, compile_targets=None,
23 targeted_tests=None, suspected_cls=None): 48 targeted_tests=None, suspected_cls=None):
24 49
25 # A list contains tuples of step_names and classified_tests from 50 # A list contains tuples of step_names and classified_tests from
26 # ProcessSwarmingTaskResultPipeline. 51 # ProcessSwarmingTaskResultPipeline.
27 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..] 52 # The format would be [('step1', {'flaky_tests': ['test1', ..], ..}), ..]
28 classified_tests_by_step = [] 53 classified_tests_by_step = []
54 targeted_base_tests = {}
29 55
30 if try_job_type == TryJobType.TEST: 56 if try_job_type == TryJobType.TEST:
31 for step_name, tests in targeted_tests.iteritems(): 57 for step_name, tests in targeted_tests.iteritems():
58 base_tests = _RemoveAnyPrefixes(tests)
59 targeted_base_tests[step_name] = base_tests
60
32 if not tests: # Skip non-swarming tests. 61 if not tests: # Skip non-swarming tests.
33 continue 62 continue
63 # Triggers swarming task for the base_tests.
34 task_id = yield TriggerSwarmingTaskPipeline( 64 task_id = yield TriggerSwarmingTaskPipeline(
35 master_name, builder_name, build_number, step_name, tests) 65 master_name, builder_name, build_number, step_name, base_tests)
36 step_future = yield ProcessSwarmingTaskResultPipeline( 66 step_future = yield ProcessSwarmingTaskResultPipeline(
37 master_name, builder_name, build_number, step_name, task_id) 67 master_name, builder_name, build_number, step_name, task_id)
38 logging_str = ( 68 logging_str = (
39 'Swarming task was scheduled for build %s/%s/%s step %s') % ( 69 'Swarming task was scheduled for build %s/%s/%s step %s') % (
40 master_name, builder_name, build_number, step_name) 70 master_name, builder_name, build_number, step_name)
41 logging.info(logging_str) 71 logging.info(logging_str)
42 classified_tests_by_step.append(step_future) 72 classified_tests_by_step.append(step_future)
43 73
44 # Waits until classified_tests_by_step are ready. 74 # Waits until classified_tests_by_step are ready.
45 yield RunTryJobForReliableFailurePipeline( 75 yield RunTryJobForReliableFailurePipeline(
46 master_name, builder_name, build_number, good_revision, 76 master_name, builder_name, build_number, good_revision,
47 bad_revision, blame_list, try_job_type, compile_targets, targeted_tests, 77 bad_revision, blame_list, try_job_type, compile_targets,
48 suspected_cls, *classified_tests_by_step) 78 targeted_base_tests, suspected_cls, *classified_tests_by_step)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698