Bug 1627340 - separate filter for try selectors and apply them to try chooser r=bc,ahal,jmaher

Changes:

  - implement filtering of taskgraph items against a list of known task filters in `tasks.py`.
  - apply these filters to both `fuzzy` and `chooser` selectors, unless `--full` is specified.

Differential Revision: https://phabricator.services.mozilla.com/D70097

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edwin Takahashi 2020-04-14 13:43:17 +00:00
Родитель 59bd6d0dee
Коммит 66ea42cb18
3 изменённых файлов: 40 добавлений и 23 удалений

Просмотреть файл

@ -9,8 +9,10 @@ import webbrowser
from threading import Timer
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 tryselect.push import check_working_directory, push_to_try, generate_try_task_config
from ...tasks import filter_tasks_by_blacklist
here = os.path.abspath(os.path.dirname(__file__))
@ -40,6 +42,14 @@ def run(update=False, query=None, try_config=None, full=False, parameters=None,
check_working_directory(push)
tg = generate_tasks(parameters, full)
# Remove tasks that are not to be shown unless `--full` is specified.
if not full:
blacklisted_tasks = [label for label in tg.tasks.keys()
if not filter_tasks_by_blacklist(label)]
for task in blacklisted_tasks:
tg.tasks.pop(task)
app = create_application(tg)
if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':

Просмотреть файл

@ -6,7 +6,6 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
import platform
import re
import subprocess
import sys
from distutils.spawn import find_executable
@ -18,7 +17,7 @@ from mozboot.util import get_state_dir
from mozterm import Terminal
from ..cli import BaseTryParser
from ..tasks import generate_tasks, filter_tasks_by_paths
from ..tasks import generate_tasks, filter_tasks_by_paths, filter_tasks_by_blacklist
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
@ -29,21 +28,6 @@ build = MozbuildObject.from_environment(cwd=here)
PREVIEW_SCRIPT = os.path.join(build.topsrcdir, 'tools/tryselect/selectors/preview.py')
# Some tasks show up in the target task set, but are either special cases
# or uncommon enough that they should only be selectable with --full.
TARGET_TASK_FILTERS = (
'-ccov/',
'windows10-aarch64/opt',
'win64-aarch64-laptop',
'windows10-64-ref-hw-2017',
'android-hw',
'android-geckoview-docs',
'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
)
FZF_NOT_FOUND = """
Could not find the `fzf` binary.
@ -296,10 +280,6 @@ def run_fzf(cmd, tasks):
return query, selected
def filter_target_task(task):
return not any(re.search(pattern, task) for pattern in TARGET_TASK_FILTERS)
def run(update=False, query=None, intersect_query=None, try_config=None, full=False,
parameters=None, save_query=False, push=True, message='{msg}',
test_paths=None, exact=False, closed_tree=False, show_estimates=False,
@ -330,7 +310,7 @@ def run(update=False, query=None, intersect_query=None, try_config=None, full=Fa
make_trimmed_taskgraph_cache(graph_cache, dep_cache, target_file=target_set)
if not full and not disable_target_task_filter:
all_tasks = filter(filter_target_task, all_tasks)
all_tasks = filter(filter_tasks_by_blacklist, all_tasks)
if test_paths:
all_tasks = filter_tasks_by_paths(all_tasks, test_paths)

Просмотреть файл

@ -26,6 +26,20 @@ 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
@ -110,6 +124,19 @@ 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)