Bug 1630350 - apply mach try filter to try syntax selector r=jmaher,gbrown

Changes:

Applies the `filter_tasks_by_blacklist` method to try syntax pushes as well.

  - moved `TARGET_TASK_BLACKLIST`and `filter_tasks_by_blacklist` method to live in `taskcluster/taskgraph/target_tasks.py`.
  - removed existing filters against `ccov, windows10-aarch64` and `android-hw` filters against try syntax pushes.
  - update imports for `fuzzy` and `chooser` selectors to refer to the new location of `filter_tasks_by_blacklist` method.

The reason for moving the logic (again) from `tools/tryselect` to `taskcluster/` is due to the placement of `try_option_syntax` and `target_tasks` files and both of those files handle the processing of `mach try syntax` pushes.

Differential Revision: https://phabricator.services.mozilla.com/D71698
This commit is contained in:
Edwin Takahashi 2020-04-21 19:51:25 +00:00
parent 54e726553b
commit e2f3473016
5 changed files with 39 additions and 43 deletions

View File

@ -6,12 +6,29 @@
from __future__ import absolute_import, print_function, unicode_literals
from re import search
from taskgraph import try_option_syntax
from taskgraph.parameters import Parameters
from taskgraph.util.attributes import match_run_on_projects, match_run_on_hg_branches
_target_task_methods = {}
# Some tasks show up in the target task set, but are possibly special cases,
# uncommon tasks, or tasks running against limited hardware set that they
# should only be selectable with --full.
TARGET_TASK_BLACKLIST = [
r'-ccov/',
r'windows10-aarch64/opt',
r'win64-aarch64-laptop',
r'windows10-64-ref-hw-2017',
r'android-hw',
r'android-geckoview-docs',
r'linux1804-32', # hide linux32 tests - bug 1599197
r'linux-', # hide all linux32 tasks by default - bug 1599197
r'linux.*web-platform-tests.*-fis-', # hide wpt linux fission tests - bug 1610879
]
def _target_task(name):
def wrap(func):
@ -58,6 +75,23 @@ def filter_on_platforms(task, platforms):
return (platform in platforms)
def filter_tasks_by_blacklist(task, optional_filters=None):
"""Filters tasks based on blacklist rules.
Args:
task (str): String representing the task name.
Returns:
(Boolean): True if task does not match any known filters.
False otherwise.
"""
if optional_filters:
for item in optional_filters:
TARGET_TASK_BLACKLIST.append(item)
return not any(search(pattern, task) for pattern in TARGET_TASK_BLACKLIST)
def filter_release_tasks(task, parameters):
platform = task.attributes.get('build_platform')
if platform in (
@ -111,7 +145,7 @@ def _try_option_syntax(full_task_graph, parameters, graph_config):
parameters['message'] and, for context, the full task graph."""
options = try_option_syntax.TryOptionSyntax(parameters, full_task_graph, graph_config)
target_tasks_labels = [t.label for t in full_task_graph.tasks.itervalues()
if options.task_matches(t)]
if options.task_matches(t) and filter_tasks_by_blacklist(t.label)]
attributes = {
k: getattr(options, k) for k in [

View File

@ -561,18 +561,6 @@ class TryOptionSyntax(object):
return False
return set(['try', 'all']) & set(attr('run_on_projects', []))
# Don't schedule code coverage when try option syntax is used
if 'ccov' in attr('build_platform', []):
return False
# Don't schedule tasks for windows10-aarch64 unless try fuzzy is used
if 'windows10-aarch64' in attr("test_platform", ""):
return False
# Don't schedule android-hw tests when try option syntax is used
if 'android-hw' in task.label:
return False
# Don't schedule fission tests when try option syntax is used
if attr('unittest_variant') == 'fission':
return False

View File

@ -12,7 +12,7 @@ from tryselect.cli import BaseTryParser
from tryselect.push import check_working_directory, generate_try_task_config, push_to_try
from tryselect.tasks import generate_tasks
from ...tasks import filter_tasks_by_blacklist
from taskgraph.target_tasks import filter_tasks_by_blacklist
here = os.path.abspath(os.path.dirname(__file__))

View File

@ -17,10 +17,12 @@ from mozboot.util import get_state_dir
from mozterm import Terminal
from ..cli import BaseTryParser
from ..tasks import generate_tasks, filter_tasks_by_paths, filter_tasks_by_blacklist
from ..tasks import generate_tasks, filter_tasks_by_paths
from ..push import check_working_directory, push_to_try, generate_try_task_config
from ..util.manage_estimates import download_task_history_data, make_trimmed_taskgraph_cache
from taskgraph.target_tasks import filter_tasks_by_blacklist
terminal = Terminal()
here = os.path.abspath(os.path.dirname(__file__))

View File

@ -26,21 +26,6 @@ from taskgraph.taskgraph import TaskGraph
here = os.path.abspath(os.path.dirname(__file__))
build = MozbuildObject.from_environment(cwd=here)
# Some tasks show up in the target task set, but are possibly special cases,
# uncommon tasks, or tasks running against limited hardware set that they
# should only be selectable with --full.
TARGET_TASK_FILTERS = (
r'-ccov/',
r'windows10-aarch64/opt',
r'win64-aarch64-laptop',
r'windows10-64-ref-hw-2017',
r'android-hw',
r'android-geckoview-docs',
r'linux1804-32', # hide linux32 tests - bug 1599197
r'linux-', # hide all linux32 tasks by default - bug 1599197
r'linux.*web-platform-tests.*-fis-', # hide wpt linux fission tests - bug 1610879
)
PARAMETER_MISMATCH = """
ERROR - The parameters being used to generate tasks differ from those expected
by your working copy:
@ -124,19 +109,6 @@ def generate_tasks(params=None, full=False):
return tg_target
def filter_tasks_by_blacklist(task):
"""Checks task label against known task filters.
Args:
task (str): String representing the task name.
Returns:
(Boolean): True if task does not match any known filters.
False otherwise.
"""
return not any(re.search(pattern, task) for pattern in TARGET_TASK_FILTERS)
def filter_tasks_by_paths(tasks, paths):
resolver = TestResolver.from_environment(cwd=here)
run_suites, run_tests = resolver.resolve_metadata(paths)