Bug 1821780 - Add -q/--query option to mach try perf. r=perftest-reviewers,afinder

Differential Revision: https://phabricator.services.mozilla.com/D172321
This commit is contained in:
Greg Mierzwinski 2023-03-13 13:37:59 +00:00
parent 673064a167
commit edde6fdf2e
2 changed files with 36 additions and 4 deletions

View File

@ -480,6 +480,15 @@ class PerfParser(CompareParser):
"help": "Run tasks without a comparison",
},
],
[
["-q", "--query"],
{
"type": str,
"default": None,
"help": "Query to run in either the perf-category selector, "
"or the fuzzy selector if --show-all is provided.",
},
],
[
["--variants"],
{
@ -543,13 +552,13 @@ class PerfParser(CompareParser):
queries.append(query_str)
return set(tasks)
def get_perf_tasks(base_cmd, all_tg_tasks, perf_categories):
def get_perf_tasks(base_cmd, all_tg_tasks, perf_categories, query=None):
# Convert the categories to tasks
selected_tasks = set()
queries = []
selected_categories = PerfParser.get_tasks(
base_cmd, queries, None, perf_categories
base_cmd, queries, query, perf_categories
)
for category, category_info in perf_categories.items():
@ -1210,6 +1219,7 @@ class PerfParser(CompareParser):
try_config=None,
dry_run=False,
single_run=False,
query=None,
**kwargs,
):
# Setup fzf
@ -1234,10 +1244,10 @@ class PerfParser(CompareParser):
# Expand the categories first
categories = PerfParser.get_categories(**kwargs)
selected_tasks, selected_categories, queries = PerfParser.get_perf_tasks(
base_cmd, all_tasks, categories
base_cmd, all_tasks, categories, query=query
)
else:
selected_tasks = PerfParser.get_tasks(base_cmd, queries, None, all_tasks)
selected_tasks = PerfParser.get_tasks(base_cmd, queries, query, all_tasks)
if len(selected_tasks) == 0:
print("No tasks selected")

View File

@ -747,6 +747,17 @@ def test_category_expansion(
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"query": "'Pageload 'linux 'firefox"},
[8, 2, 2, 5],
2,
(
"\n!!!NOTE!!!\n You'll be able to find a performance comparison "
"here once the tests are complete (ensure you select the right framework): "
"https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original"
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"dry_run": True},
[8, 1, 1, 5],
@ -769,6 +780,17 @@ def test_category_expansion(
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"show_all": True, "query": "'shippable !32 speedometer 'firefox"},
[1, 2, 2, 3],
0,
(
"\n!!!NOTE!!!\n You'll be able to find a performance comparison "
"here once the tests are complete (ensure you select the right framework): "
"https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original"
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"single_run": True},
[8, 1, 1, 4],