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
This commit is contained in:
Andrew Halberstadt 2020-08-26 19:11:22 +00:00
parent 81eecf7f8c
commit 0def0cc961
2 changed files with 1 additions and 22 deletions

View File

@ -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

View File

@ -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()