From 85fdc991a083942b3bc3e4a160014b947a8af993 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 28 Apr 2020 14:53:20 +0000 Subject: [PATCH] Bug 1629642 - [taskgraph] Split 'test' optimization strategy arg into two r=marco The default way to split the 'arg' parameter for CompositeStrategies, is to duplicate it across all substrategies. By setting 'split_arg=tuple', we instead break the arg up so the first index goes to the first substrategy, the second index goes to the second substrategy, etc. This means that the length of the 'test' arg must be at least as long as the number of substrategies. Differential Revision: https://phabricator.services.mozilla.com/D72464 --- taskcluster/taskgraph/optimize/__init__.py | 27 ++++++++++++++-------- taskcluster/taskgraph/transforms/tests.py | 4 +++- taskcluster/taskgraph/util/schema.py | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/taskcluster/taskgraph/optimize/__init__.py b/taskcluster/taskgraph/optimize/__init__.py index 8880cb44e533..e27631f10d77 100644 --- a/taskcluster/taskgraph/optimize/__init__.py +++ b/taskcluster/taskgraph/optimize/__init__.py @@ -377,7 +377,10 @@ import_sibling_modules() # Register composite strategies. register_strategy('build', args=('skip-unless-schedules',))(Alias) register_strategy('build-fuzzing', args=('skip-unless-schedules', 'seta'))(Any) -register_strategy('test', args=(Any('skip-unless-schedules', 'seta'), 'backstop'))(All) +register_strategy('test', args=( + Any('skip-unless-schedules', 'seta', split_args=tuple), + 'backstop', +))(All) register_strategy('test-inclusive', args=('skip-unless-schedules',))(Alias) register_strategy('test-try', args=('skip-unless-schedules',))(Alias) @@ -394,48 +397,52 @@ class experimental(object): """ bugbug_all = { - 'test': Any('skip-unless-schedules', 'bugbug'), + 'test': Any('skip-unless-schedules', 'bugbug', split_args=tuple), } """Doesn't limit platforms, medium confidence threshold.""" bugbug_all_low = { - 'test': Any('skip-unless-schedules', 'bugbug-low'), + 'test': Any('skip-unless-schedules', 'bugbug-low', split_args=tuple), } """Doesn't limit platforms, low confidence threshold.""" bugbug_all_high = { - 'test': Any('skip-unless-schedules', 'bugbug-high'), + 'test': Any('skip-unless-schedules', 'bugbug-high', split_args=tuple), } """Doesn't limit platforms, high confidence threshold.""" bugbug_combined_high = { - 'test': Any('skip-unless-schedules', 'bugbug-combined-high'), + 'test': Any('skip-unless-schedules', 'bugbug-combined-high', split_args=tuple), } """Combines the weights of all groups, high confidence threshold.""" bugbug_debug = { - 'test': Any('skip-unless-schedules', 'bugbug', 'platform-debug'), + 'test': Any( + 'skip-unless-schedules', + Any('bugbug', 'platform-debug'), + split_args=tuple + ), } """Restricts tests to debug platforms.""" bugbug_reduced = { - 'test': Any('skip-unless-schedules', 'bugbug-reduced'), + 'test': Any('skip-unless-schedules', 'bugbug-reduced', split_args=tuple), } """Use the reduced set of tasks (and no groups) chosen by bugbug.""" bugbug_reduced_high = { - 'test': Any('skip-unless-schedules', 'bugbug-reduced-high'), + 'test': Any('skip-unless-schedules', 'bugbug-reduced-high', split_args=tuple), } """Use the reduced set of tasks (and no groups) chosen by bugbug, high confidence threshold.""" relevant_tests = { - 'test': Any('skip-unless-schedules', 'skip-unless-has-relevant-tests'), + 'test': Any('skip-unless-schedules', 'skip-unless-has-relevant-tests', split_args=tuple), } """Runs task containing tests in the same directories as modified files.""" seta = { - 'test': Any('skip-unless-schedules', 'seta'), + 'test': Any('skip-unless-schedules', 'seta', split_args=tuple), } """Provides a stable history of SETA's performance in the event we make it non-default in the future. Only useful as a benchmark.""" diff --git a/taskcluster/taskgraph/transforms/tests.py b/taskcluster/taskgraph/transforms/tests.py index a59457b40085..71cc57ed3dd5 100644 --- a/taskcluster/taskgraph/transforms/tests.py +++ b/taskcluster/taskgraph/transforms/tests.py @@ -1593,7 +1593,9 @@ def make_job_description(config, tests): elif category in INCLUSIVE_COMPONENTS: jobdesc['optimization'] = {'test-inclusive': schedules} else: - jobdesc['optimization'] = {'test': schedules} + # First arg goes to 'skip-unless-schedules', second goes to the + # main test strategy. + jobdesc['optimization'] = {'test': (schedules, None)} run = jobdesc['run'] = {} run['using'] = 'mozharness-test' diff --git a/taskcluster/taskgraph/util/schema.py b/taskcluster/taskgraph/util/schema.py index f957cbf69b9a..ccf18660303b 100644 --- a/taskcluster/taskgraph/util/schema.py +++ b/taskcluster/taskgraph/util/schema.py @@ -214,7 +214,7 @@ OptimizationSchema = voluptuous.Any( # skip this task if unless the change files' SCHEDULES contains any of these components {'skip-unless-schedules': list(schedules.ALL_COMPONENTS)}, # optimize strategy aliases for the test kind - {'test': list(schedules.ALL_COMPONENTS)}, + {'test': (list(schedules.ALL_COMPONENTS), None)}, {'test-inclusive': list(schedules.ALL_COMPONENTS)}, {'test-try': list(schedules.ALL_COMPONENTS)}, )