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
This commit is contained in:
Andrew Halberstadt 2020-04-28 14:53:20 +00:00
parent 9355164d5f
commit 85fdc991a0
3 changed files with 21 additions and 12 deletions

View File

@ -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."""

View File

@ -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'

View File

@ -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)},
)