Bug 1637385 - [taskgraph] Remove the bugbug 'combined' flag and related shadow-scheduler, r=marco
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 15 May 2020 14:04:56 +0000
changeset 530279 f8e3742a6ca5d90be0bd5cc7501bf30eaab219a0
parent 530278 eb882d1719d2db8d44a48599596a5aedbe899c69
child 530280 5a12d30f801904002cad32c9484b6df0a0830090
push id37420
push usernerli@mozilla.com
push dateFri, 15 May 2020 21:52:36 +0000
treeherdermozilla-central@f340bbb582d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarco
bugs1637385
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1637385 - [taskgraph] Remove the bugbug 'combined' flag and related shadow-scheduler, r=marco This feature A) scheduled way too many tasks, and B) won't be that useful anyway once we switch to manifest-scheduling. Differential Revision: https://phabricator.services.mozilla.com/D75399
taskcluster/ci/source-test/shadow-scheduler.yml
taskcluster/taskgraph/optimize/__init__.py
taskcluster/taskgraph/optimize/bugbug.py
taskcluster/taskgraph/test/test_optimize_strategies.py
--- a/taskcluster/ci/source-test/shadow-scheduler.yml
+++ b/taskcluster/ci/source-test/shadow-scheduler.yml
@@ -50,27 +50,16 @@ bugbug_all_high:
         symbol: SS(bugbug_all_high)
     index:
         product: source
         job-name: shadow-scheduler-bugbug_all_high
     worker:
         env:
             TASKGRAPH_OPTIMIZE_STRATEGIES: taskgraph.optimize:experimental.bugbug_all_high
 
-bugbug_combined_high:
-    description: Runs the bugbug_combined_high optimization strategy instead of the default.
-    treeherder:
-        symbol: SS(bugbug_combined_high)
-    index:
-        product: source
-        job-name: shadow-scheduler-bugbug_combined_high
-    worker:
-        env:
-            TASKGRAPH_OPTIMIZE_STRATEGIES: taskgraph.optimize:experimental.bugbug_combined_high
-
 bugbug_debug:
     description: Runs the bugbug_debug optimization strategy instead of the default.
     treeherder:
         symbol: SS(bugbug_debug)
     index:
         product: source
         job-name: shadow-scheduler-bugbug_debug
     worker:
--- a/taskcluster/taskgraph/optimize/__init__.py
+++ b/taskcluster/taskgraph/optimize/__init__.py
@@ -401,21 +401,16 @@ class experimental(object):
     }
     """Doesn't limit platforms, medium confidence threshold."""
 
     bugbug_all_high = {
         'test': Any('skip-unless-schedules', 'bugbug-high', split_args=tuple),
     }
     """Doesn't limit platforms, high confidence threshold."""
 
-    bugbug_combined_high = {
-        'test': Any('skip-unless-schedules', 'bugbug-combined-high', split_args=tuple),
-    }
-    """Combines the weights of all groups, high confidence threshold."""
-
     bugbug_debug = {
         'test': Any(
             'skip-unless-schedules',
             Any('bugbug', 'platform-debug'),
             split_args=tuple
         ),
     }
     """Restricts tests to debug platforms."""
--- a/taskcluster/taskgraph/optimize/bugbug.py
+++ b/taskcluster/taskgraph/optimize/bugbug.py
@@ -14,45 +14,41 @@ from taskgraph.util.bugbug import (
     push_schedules,
     CT_HIGH,
     CT_MEDIUM,
     CT_LOW,
 )
 
 
 @register_strategy("bugbug", args=(CT_MEDIUM,))
-@register_strategy("bugbug-combined-high", args=(CT_HIGH, False, True))
 @register_strategy("bugbug-low", args=(CT_LOW,))
 @register_strategy("bugbug-high", args=(CT_HIGH,))
 @register_strategy("bugbug-reduced", args=(CT_MEDIUM, True))
-@register_strategy("bugbug-reduced-fallback", args=(CT_MEDIUM, True, False, True))
+@register_strategy("bugbug-reduced-fallback", args=(CT_MEDIUM, True, True))
 @register_strategy("bugbug-reduced-high", args=(CT_HIGH, True))
 class BugBugPushSchedules(OptimizationStrategy):
     """Query the 'bugbug' service to retrieve relevant tasks and manifests.
 
     Args:
         confidence_threshold (float): The minimum confidence threshold (in
             range [0, 1]) needed for a task to be scheduled.
         use_reduced_tasks (bool): Whether or not to use the reduced set of tasks
             provided by the bugbug service (default: False).
-        combine_weights (bool): If True, sum the confidence thresholds of all
-            groups within a task to find the overall task confidence. Otherwise
-            the maximum confidence threshold is used (default: False).
+        fallback (bool): Whether or not to fallback to SETA if there was a failure
+            in bugbug (default: False)
     """
 
     def __init__(
         self,
         confidence_threshold,
         use_reduced_tasks=False,
-        combine_weights=False,
         fallback=False,
     ):
         self.confidence_threshold = confidence_threshold
         self.use_reduced_tasks = use_reduced_tasks
-        self.combine_weights = combine_weights
         self.fallback = fallback
         self.timedout = False
 
     def should_remove_task(self, task, params, importance):
         if params['project'] not in ("autoland", "try"):
             return False
 
         branch = urlsplit(params['head_repository']).path.strip('/')
@@ -82,33 +78,20 @@ class BugBugPushSchedules(OptimizationSt
             if "known_tasks" in data and task.label not in data["known_tasks"]:
                 return False
 
             if task.label not in tasks:
                 return True
 
             return False
 
-        # If a task contains more than one group, figure out which confidence
-        # threshold to use. If 'self.combine_weights' is set, add up all
-        # confidence thresholds. Otherwise just use the max.
-        task_confidence = 0
+        # If a task contains more than one group, use the max confidence.
         groups = data.get("groups", {})
-        for group, confidence in groups.items():
-            if group not in test_manifests:
-                continue
-
-            if self.combine_weights:
-                task_confidence = round(
-                    task_confidence + confidence - task_confidence * confidence, 2
-                )
-            else:
-                task_confidence = max(task_confidence, confidence)
-
-        if task_confidence < self.confidence_threshold:
+        confidences = [c for g, c in groups.items() if g in test_manifests]
+        if not confidences or max(confidences) < self.confidence_threshold:
             return True
 
         # Store group importance so future optimizers can access it.
         for manifest in test_manifests:
             if manifest not in groups:
                 continue
 
             confidence = groups[manifest]
--- a/taskcluster/taskgraph/test/test_optimize_strategies.py
+++ b/taskcluster/taskgraph/test/test_optimize_strategies.py
@@ -170,33 +170,16 @@ def test_optimization_strategy(responses
 
     # tasks containing groups selected
     pytest.param(
         (0.1,),
         {'groups': {'foo/test.ini': 0.4}},
         ['task-0'],
     ),
 
-    # tasks containing multiple groups have a higher overall confidence with combined_weights
-    pytest.param(
-        (0.75, False, False),
-        {'groups': {'foo/test.ini': 0.5, 'bar/test.ini': 0.5}},
-        [],
-    ),
-    pytest.param(
-        (0.75, False, True),
-        {'groups': {'foo/test.ini': 0.5, 'bar/test.ini': 0.5}},
-        ['task-0'],
-    ),
-    pytest.param(
-        (0.76, False, True),
-        {'groups': {'foo/test.ini': 0.5, 'bar/test.ini': 0.5}},
-        [],
-    ),
-
     # tasks matching "tasks" or "groups" selected
     pytest.param(
         (0.1,),
         {'tasks': {'task-2': 0.2}, 'groups': {'foo/test.ini': 0.25, 'bar/test.ini': 0.75}},
         ['task-0', 'task-1', 'task-2'],
     ),
 
     # tasks matching "tasks" or "groups" selected, when they exceed the confidence threshold