Bug 1638103 - Stop trying to hit bugbug after it times out. r=ahal

Differential Revision: https://phabricator.services.mozilla.com/D75409
This commit is contained in:
Marco Castelluccio 2020-05-14 20:05:48 +00:00
Родитель cbd2ddf64f
Коммит 5747ae4098
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -49,6 +49,7 @@ class BugBugPushSchedules(OptimizationStrategy):
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"):
@ -56,13 +57,18 @@ class BugBugPushSchedules(OptimizationStrategy):
branch = urlsplit(params['head_repository']).path.strip('/')
rev = params['head_rev']
if self.timedout:
return seta.is_low_value_task(task.label, params['project'])
try:
data = push_schedules(branch, rev)
except BugbugTimeoutException:
if self.fallback:
return seta.is_low_value_task(task.label, params['project'])
if not self.fallback:
raise
raise
self.timedout = True
return self.should_remove_task(task, params, importance)
key = "reduced_tasks" if self.use_reduced_tasks else "tasks"
tasks = set(

Просмотреть файл

@ -272,6 +272,10 @@ def test_bugbug_fallback(monkeypatch, responses, params):
opt = BugBugPushSchedules(0.5, fallback=True)
assert opt.should_remove_task(default_tasks[0], params, None)
# Make sure we don't hit bugbug more than once.
responses.reset()
assert not opt.should_remove_task(default_tasks[1], params, None)