# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os import sys from pathlib import PurePath
from gecko_taskgraph.target_tasks import filter_by_uncommon_try_tasks from mach.util import get_state_dir
from ..cli import BaseTryParser from ..push import check_working_directory, generate_try_task_config, push_to_try from ..tasks import filter_tasks_by_paths, filter_tasks_by_worker_type, generate_tasks from ..util.fzf import (
FZF_NOT_FOUND,
PREVIEW_SCRIPT,
format_header,
fzf_bootstrap,
fzf_shortcuts,
run_fzf,
) from ..util.manage_estimates import (
download_task_history_data,
make_trimmed_taskgraph_cache,
)
class FuzzyParser(BaseTryParser):
name = "fuzzy"
arguments = [
[
["-q", "--query"],
{ "metavar": "STR", "action": "append", "default": [], "help": "Use the given query instead of entering the selection " "interface. Equivalent to typing " "from the interface. Specifying multiple times schedules " "the union of computed tasks.",
},
],
[
["-i", "--interactive"],
{ "action": "store_true", "default": False, "help": "Force running fzf interactively even when using presets or " "queries with -q/--query.",
},
],
[
["-x", "--and"],
{ "dest": "intersection", "action": "store_true", "default": False, "help": "When specifying queries on the command line with -q/--query, " "use the intersection of tasks rather than the union. This is " "especially useful for post filtering presets.",
},
],
[
["-e", "--exact"],
{ "action": "store_true", "default": False, "help": "Enable exact match mode. Terms will use an exact match " "by default, and terms prefixed with ' will become fuzzy.",
},
],
[
["-u", "--update"],
{ "action": "store_true", "default": False, "help": "Update fzf before running.",
},
],
[
["-s", "--show-estimates"],
{ "action": "store_true", "default": False, "help": "Show task duration estimates.",
},
],
[
["--disable-target-task-filter", "--all-tasks"],
{ "action": "store_true", "default": False, "help": "Some tasks run on mozilla-central but are filtered out " "of the default list due to resource constraints. This flag " "disables this filtering.",
},
],
[
["--show-chunk-numbers"],
{ "action": "store_true", "default": False, "help": "Chunk numbers are hidden to simplify the selection. This flag " "makes them appear again.",
},
],
]
common_groups = ["push", "task", "preset"]
task_configs = [ "artifact", "browsertime", "chemspill-prio", "disable-pgo", "env", "existing-tasks", "gecko-profile", "new-test-config", "path", "test-tag", "pernosco", "rebuild", "routes", "worker-overrides",
]
# graph_Cache created by generate_tasks, recreate the path to that file.
cache_dir = os.path.join(
get_state_dir(specific_to_topsrcdir=True), "cache", "taskgraph"
) if full:
graph_cache = os.path.join(cache_dir, "full_task_graph")
dep_cache = os.path.join(cache_dir, "full_task_dependencies")
target_set = os.path.join(cache_dir, "full_task_set") else:
graph_cache = os.path.join(cache_dir, "target_task_graph")
dep_cache = os.path.join(cache_dir, "target_task_dependencies")
target_set = os.path.join(cache_dir, "target_task_set")
if show_estimates:
download_task_history_data(cache_dir=cache_dir)
make_trimmed_taskgraph_cache(graph_cache, dep_cache, target_file=target_set)
ifnot full andnot disable_target_task_filter:
all_tasks = {
task_name: task for task_name, task in all_tasks.items() if filter_by_uncommon_try_tasks(task_name)
}
for q in intersect_query or []: ifnot selected:
selected |= get_tasks(q) else:
selected &= get_tasks(
q,
{
task_name: task for task_name, task in all_tasks.items() if task_name in selected or task.chunk_pattern in selected
},
)
ifnot queries:
selected = get_tasks()
ifnot selected:
print("no tasks selected") return
if save_query: return queries
# build commit message
msg = "Fuzzy"
args = ["query={}".format(q) for q in queries] if test_paths:
args.append("paths={}".format(":".join(test_paths))) if args:
msg = "{} {}".format(msg, "&".join(args)) return push_to_try( "fuzzy",
message.format(msg=msg),
try_task_config=generate_try_task_config( "fuzzy", selected, params=try_config_params
),
stage_changes=stage_changes,
dry_run=dry_run,
closed_tree=closed_tree,
push_to_lando=push_to_lando,
push_to_vcs=push_to_vcs,
)
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.