gecko_taskgraph.optimize package
Submodules
gecko_taskgraph.optimize.backstop module
- class gecko_taskgraph.optimize.backstop.SkipUnlessAndroidPerftestBackstop
Bases:
OptimizationStrategy
Always removes tasks except on backstop pushes.
- should_remove_task(task, params, _)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.backstop.SkipUnlessBackstop
Bases:
OptimizationStrategy
Always removes tasks except on backstop pushes.
- should_remove_task(task, params, _)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.backstop.SkipUnlessPushInterval(push_interval, remove_on_projects=None)
Bases:
OptimizationStrategy
Always removes tasks except every N pushes.
- Parameters:
push_interval (int) – Number of pushes
- property description
- should_remove_task(task, params, _)
Determine whether to optimize this task by removing it. Returns True to remove.
gecko_taskgraph.optimize.bugbug module
- class gecko_taskgraph.optimize.bugbug.BugBugPushSchedules(confidence_threshold, tasks_only=False, use_reduced_tasks=False, fallback=None, num_pushes=1, select_configs=False)
Bases:
OptimizationStrategy
Query the ‘bugbug’ service to retrieve relevant tasks and manifests.
- Parameters:
confidence_threshold (float) – The minimum confidence threshold (in range [0, 1]) needed for a task to be scheduled.
tasks_only (bool) – Whether or not to only use tasks and no groups (default: False)
use_reduced_tasks (bool) – Whether or not to use the reduced set of tasks provided by the bugbug service (default: False).
fallback (str) – The fallback strategy to use if there was a failure in bugbug (default: None)
num_pushes (int) – The number of pushes to consider for the selection (default: 1).
select_configs (bool) – Whether to select configurations for manifests too (default: False).
- should_remove_task(task, params, importance)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.bugbug.DisperseGroups(target_counts=None, unseen_modifier=1)
Bases:
OptimizationStrategy
Disperse groups across test configs.
Each task has an associated ‘importance’ dict passed in via the arg. This is of the form {<group>: <importance>}.
Where ‘group’ is a test group id (usually a path to a manifest), and ‘importance’ is one of {‘lowest’, ‘low’, ‘medium’, ‘high’}.
Each importance value has an associated ‘count’ as defined in self.target_counts. It guarantees that ‘manifest’ will run in at least ‘count’ different configurations (assuming there are enough tasks containing ‘manifest’).
On configurations that haven’t been seen before, we’ll increase the target count by self.unseen_modifier to increase the likelihood of scheduling a task on that configuration.
- Parameters:
target_counts (dict) – Override DEFAULT_TARGET_COUNTS with custom counts. This is a dict mapping the importance value (‘lowest’, ‘low’, etc) to the minimum number of configurations manifests with this value should run on.
unseen_modifier (int) – Override DEFAULT_UNSEEN_MODIFIER to a custom value. This is the amount we’ll increase ‘target_count’ by for unseen configurations.
- DEFAULT_TARGET_COUNTS = {'high': 3, 'low': 1, 'lowest': 0, 'medium': 2}
- DEFAULT_UNSEEN_MODIFIER = 1
- should_remove_task(task, params, importance)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.bugbug.SkipUnlessDebug
Bases:
OptimizationStrategy
Only run debug platforms.
- should_remove_task(task, params, arg)
Determine whether to optimize this task by removing it. Returns True to remove.
- gecko_taskgraph.optimize.bugbug.merge_bugbug_replies(data, new_data)
Merge a bugbug reply (stored in the new_data argument) into another (stored in the data argument).
gecko_taskgraph.optimize.mozlint module
- class gecko_taskgraph.optimize.mozlint.SkipUnlessMozlint(linters_path: str)
Bases:
OptimizationStrategy
Optimization strategy for mozlint tests.
Uses the mozlint YAML file for each test to determine whether or not a test should run.
- Using:
The optimization relies on having files_changed set in the decision task parameters.
Register with register_strategy. The argument is the path to MozLint YAML configuration files (“/tools/lint” for mozilla-central):
In source-test/mozlint.yml, set the optimization strategy for each job by filename:
For Mozlint jobs that run multiple linters at once use a list of filenames:
- should_remove_task(task, params, mozlint_confs: str | List[str]) bool
Determine whether to optimize this task by removing it. Returns True to remove.
gecko_taskgraph.optimize.schema module
- gecko_taskgraph.optimize.schema.set_optimization_schema(schema_tuple)
Sets OptimizationSchema so it can be imported by the task transform. This function is called by projects that extend Firefox’s taskgraph. It should be called by the project’s taskgraph:register function before any transport or job runner code is imported.
- Parameters:
schema_tuple (tuple) – Tuple of possible optimization strategies
gecko_taskgraph.optimize.strategies module
- class gecko_taskgraph.optimize.strategies.SkipUnlessChanged
Bases:
OptimizationStrategy
- check(files_changed, patterns)
- should_remove_task(task, params, file_patterns)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.strategies.SkipUnlessHasRelevantTests
Bases:
OptimizationStrategy
Optimizes tasks that don’t run any tests that were in child directories of a modified file.
- get_changed_dirs(files_changed)
- should_remove_task(task, params, _)
Determine whether to optimize this task by removing it. Returns True to remove.
- class gecko_taskgraph.optimize.strategies.SkipUnlessMissing
Bases:
OptimizationStrategy
Skips a task unless it is missing from a specified index.
This simply defers to Taskgraph’s index-search optimization. The reason we need this shim is because replacement and removal optimizations can’t be joined together in a composite strategy as removal and replacement happen at different times.
- index_search = <taskgraph.optimize.strategies.IndexSearch object>
- should_remove_task(task, params, index)
Determine whether to optimize this task by removing it. Returns True to remove.
Module contents
The objective of optimization is to remove as many tasks from the graph as possible, as efficiently as possible, thereby delivering useful results as quickly as possible. For example, ideally if only a test script is modified in a push, then the resulting graph contains only the corresponding test suite task.
See taskcluster/docs/optimization.rst
for more information.
- class gecko_taskgraph.optimize.ExperimentalOverride(base, overrides)
Bases:
object
Overrides dictionaries that are stored in a container with new values.
This can be used to modify all strategies in a collection the same way, presumably with strategies affecting kinds of tasks tangential to the current context.
- Parameters:
base (object) – A container class supporting attribute access.
overrides (dict) – Values to update any accessed dictionaries with.
- class gecko_taskgraph.optimize.experimental
Bases:
object
Experimental strategies either under development or used as benchmarks.
These run as “shadow-schedulers” on each autoland push (tier 3) and/or can be used with ./mach try auto. E.g:
./mach try auto –strategy relevant_tests
- bugbug_debug_disperse = {'test': <taskgraph.optimize.base.Any object>}
Restricts tests to debug platforms.
- bugbug_disperse_high = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms, high confidence threshold.
- bugbug_disperse_low = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms, low confidence threshold.
- bugbug_disperse_medium = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms, medium confidence threshold.
- bugbug_disperse_medium_no_unseen = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms (no modified for unseen configurations), medium confidence threshold.
- bugbug_disperse_medium_only_one = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms (one platform per group), medium confidence threshold.
- bugbug_disperse_reduced_medium = {'test': <taskgraph.optimize.base.Any object>}
Disperse tests across platforms, medium confidence threshold with reduced tasks.
- bugbug_reduced = {'test': <taskgraph.optimize.base.Any object>}
Use the reduced set of tasks (and no groups) chosen by bugbug.
- bugbug_reduced_high = {'test': <taskgraph.optimize.base.Any object>}
Use the reduced set of tasks (and no groups) chosen by bugbug, high confidence threshold.
- bugbug_reduced_manifests_config_selection_low = {'test': <taskgraph.optimize.base.Any object>}
Choose configs selected by bugbug, low confidence threshold with reduced tasks.
- bugbug_reduced_manifests_config_selection_medium = {'test': <taskgraph.optimize.base.Any object>}
Choose configs selected by bugbug, medium confidence threshold with reduced tasks.
- bugbug_tasks_high = {'test': <taskgraph.optimize.base.Any object>}
Doesn’t limit platforms, high confidence threshold.
- bugbug_tasks_medium = {'test': <taskgraph.optimize.base.Any object>}
Doesn’t limit platforms, medium confidence threshold.
- relevant_tests = {'test': <taskgraph.optimize.base.Any object>}
Runs task containing tests in the same directories as modified files.
- class gecko_taskgraph.optimize.project
Bases:
object
Strategies that should be applied per-project.
- autoland = {'build': <taskgraph.optimize.base.All object>, 'test': <taskgraph.optimize.base.Any object>}
Strategy overrides that apply to autoland.
- gecko_taskgraph.optimize.split_bugbug_arg(arg, substrategies)
Split args for bugbug based strategies.
Many bugbug based optimizations require passing an empty dict by reference to communicate to downstream strategies. This function passes the provided arg to the first (non bugbug) strategies and a shared empty dict to the bugbug strategy and all substrategies after it.