From 0def0cc9610fbb113be67671150e830a16280e22 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 26 Aug 2020 19:11:22 +0000 Subject: [PATCH] Bug 1660506 - Drop the 'remove_on_projects' feature from the Backstop optimization, r=marco In the past, the 'backstop' optimization was applied to tasks by default across all projects, even though it only really made sense on autoland. To choose what would happen on non-autoland branches, we invented this 'remove_on_projects' concept. These days, we only apply the backstop optimization in the first place for autoland. So 'remove_on_projects' is no longer necessary. Depends on D88149 Differential Revision: https://phabricator.services.mozilla.com/D88150 --- taskcluster/taskgraph/optimize/backstop.py | 12 ------------ .../taskgraph/test/test_optimize_strategies.py | 11 +---------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/taskcluster/taskgraph/optimize/backstop.py b/taskcluster/taskgraph/optimize/backstop.py index 2cba57d39a15..e485dc1d1ea1 100644 --- a/taskcluster/taskgraph/optimize/backstop.py +++ b/taskcluster/taskgraph/optimize/backstop.py @@ -5,7 +5,6 @@ from __future__ import absolute_import, print_function, unicode_literals from taskgraph.optimize import OptimizationStrategy, register_strategy -from taskgraph.util.attributes import match_run_on_projects from taskgraph.util.backstop import is_backstop, BACKSTOP_PUSH_INTERVAL, BACKSTOP_TIME_INTERVAL @@ -20,23 +19,12 @@ class Backstop(OptimizationStrategy): push_interval (int): Number of pushes time_interval (int): Minutes between forced schedules. Use 0 to disable. - remove_on_projects (set): For non-autoland projects, the task will - be removed if we're running on one of these projects, otherwise - it will be kept. """ def __init__(self, push_interval, time_interval, remove_on_projects=None): self.push_interval = push_interval self.time_interval = time_interval - self.remove_on_projects = remove_on_projects or {'try'} def should_remove_task(self, task, params, _): - project = params["project"] - - # Scheduling on a backstop only makes sense on autoland. For other projects, - # remove the task if the project matches self.remove_on_projects. - if project != 'autoland': - return match_run_on_projects(project, self.remove_on_projects) - if is_backstop(params, self.push_interval, self.time_interval): return False return True diff --git a/taskcluster/taskgraph/test/test_optimize_strategies.py b/taskcluster/taskgraph/test/test_optimize_strategies.py index 983f2d20c52a..14dfdc8b08b2 100644 --- a/taskcluster/taskgraph/test/test_optimize_strategies.py +++ b/taskcluster/taskgraph/test/test_optimize_strategies.py @@ -312,7 +312,7 @@ def test_bugbug_fallback(monkeypatch, responses, params): def test_backstop(responses, params): all_labels = {t.label for t in default_tasks} - opt = Backstop(10, 60, {'try'}) # every 10th push or 1 hour + opt = Backstop(10, 60) # every 10th push or 1 hour responses.add( responses.GET, @@ -357,15 +357,6 @@ def test_backstop(responses, params): scheduled = {t.label for t in default_tasks if not opt.should_remove_task(t, params, None)} assert scheduled == all_labels - # On non-autoland projects the 'remove_on_projects' value is used. - params['project'] = 'mozilla-central' - scheduled = {t.label for t in default_tasks if not opt.should_remove_task(t, params, None)} - assert scheduled == all_labels - - params['project'] = 'try' - scheduled = {t.label for t in default_tasks if not opt.should_remove_task(t, params, None)} - assert scheduled == set() - if __name__ == '__main__': main()