commit 5c1f371d90260fb75d50811af99d29fe38642cd4
parent 600e9b0e54b17801784d9df52ab7cd9c126132ac
Author: Bastien Orivel <borivel@mozilla.com>
Date: Tue, 6 Jan 2026 11:02:27 +0000
Bug 2008582 - Use upstream taskgraph skip-unless-changed. r=releng-reviewers,taskgraph-reviewers,ahal
The memoize isn't in upstream taskgraph but my tests on a m-c push
parameters file show basically no difference
```
Benchmark 1: before (HEAD~1)
Time (mean ± σ): 18.789 s ± 0.402 s [User: 43.419 s, System: 5.570 s]
Range (min … max): 18.294 s … 19.618 s 10 runs
Benchmark 2: after (HEAD)
Time (mean ± σ): 18.470 s ± 0.333 s [User: 43.264 s, System: 5.564 s]
Range (min … max): 18.085 s … 19.056 s 10 runs
Summary
after (HEAD) ran
1.02 ± 0.03 times faster than before (HEAD~1)
```
Differential Revision: https://phabricator.services.mozilla.com/D277898
Diffstat:
2 files changed, 0 insertions(+), 43 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/__init__.py b/taskcluster/gecko_taskgraph/__init__.py
@@ -56,8 +56,6 @@ def register(graph_config):
Args:
graph_config: The graph configuration object.
"""
- from taskgraph.optimize.base import registry
-
from gecko_taskgraph import ( # noqa
filter_tasks,
morph,
@@ -69,11 +67,6 @@ def register(graph_config):
)
from gecko_taskgraph.util.verify import verifications
- # TODO: Remove along with
- # `gecko_taskgraph.optimize.strategies.SkipUnlessChanged`
- # (see comment over there)
- del registry["skip-unless-changed"]
-
register_mozilla_taskgraph(graph_config)
register_android_taskgraph(graph_config)
diff --git a/taskcluster/gecko_taskgraph/optimize/strategies.py b/taskcluster/gecko_taskgraph/optimize/strategies.py
@@ -12,7 +12,6 @@ from mozbuild.util import memoize
from taskgraph.optimize.base import OptimizationStrategy, register_strategy
from taskgraph.optimize.strategies import IndexSearch
from taskgraph.util.parameterization import resolve_timestamps
-from taskgraph.util.path import match as match_path
from gecko_taskgraph.optimize.mozlint import SkipUnlessMozlint
@@ -75,41 +74,6 @@ class SkipUnlessHasRelevantTests(OptimizationStrategy):
return True
-# TODO: This overwrites upstream Taskgraph's `skip-unless-changed`
-# optimization. Once the firefox-android migration is landed and we upgrade
-# upstream Taskgraph to a version that doesn't call files_changed.check`, this
-# class can be deleted. Also remove the `taskgraph.optimize.base.registry` tweak
-# in `gecko_taskgraph.register` at the same time.
-@register_strategy("skip-unless-changed")
-class SkipUnlessChanged(OptimizationStrategy):
- @memoize
- def _match_path(self, path, pattern):
- return match_path(path, pattern)
-
- def check(self, files_changed, patterns):
- """Optimized check using memoized path matching"""
- # Check if any path matches any pattern
- # short-circuits on first match via generator
- return any(
- self._match_path(path, pattern)
- for path in files_changed
- for pattern in patterns
- )
-
- def should_remove_task(self, task, params, file_patterns):
- # pushlog_id == -1 - this is the case when run from a cron.yml job or on a git repository
- if params.get("repository_type") == "hg" and params.get("pushlog_id") == -1:
- return False
-
- changed = self.check(params["files_changed"], file_patterns)
- if not changed:
- logger.debug(
- f'no files found matching a pattern in `skip-unless-changed` for "{task.label}"'
- )
- return True
- return False
-
-
register_strategy("skip-unless-mozlint", args=("tools/lint",))(SkipUnlessMozlint)