Bug 1624437 - [taskgraph] Handle the upcoming data format in the bugbug optimization strategy, DONTBUILD, r=marco
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 24 Mar 2020 14:37:08 +0000
changeset 520219 6aaf783eec1937d65b8bf6716bf17fa7c86ac15d
parent 520218 06b9dd699708bde495f8b58a751d86e568c4cc42
child 520220 eb0786104e9e5cd6f974009b8e75fbb8d35f5837
push id37245
push useropoprus@mozilla.com
push dateTue, 24 Mar 2020 21:46:41 +0000
treeherdermozilla-central@dbabf2e388fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarco
bugs1624437
milestone76.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 1624437 - [taskgraph] Handle the upcoming data format in the bugbug optimization strategy, DONTBUILD, r=marco Differential Revision: https://phabricator.services.mozilla.com/D67925
taskcluster/taskgraph/optimize/bugbug.py
taskcluster/taskgraph/test/test_optimize_strategies.py
--- a/taskcluster/taskgraph/optimize/bugbug.py
+++ b/taskcluster/taskgraph/optimize/bugbug.py
@@ -52,13 +52,13 @@ class BugBugPushSchedules(OptimizationSt
 
     def should_remove_task(self, task, params, arg):
         branch = urlsplit(params['head_repository']).path.strip('/')
         rev = params['head_rev']
         data = self.run_query('/push/{branch}/{rev}/schedules'.format(branch=branch, rev=rev))
 
         test_manifests = task.attributes.get('test_manifests')
         if test_manifests is None:
-            if task.label in data.get('tasks', []):
+            if task.label in data.get('tasks', {}):
                 return False
             return True
 
-        return not bool(set(task.attributes['test_manifests']) & set(data.get('groups', [])))
+        return not bool(set(task.attributes['test_manifests']) & set(data.get('groups', {})))
--- a/taskcluster/taskgraph/test/test_optimize_strategies.py
+++ b/taskcluster/taskgraph/test/test_optimize_strategies.py
@@ -46,29 +46,33 @@ def tasks(generate_tasks):
         {'attributes': {}},
         {'attributes': {'test_manifests': []}},
     ))
 
 
 @pytest.mark.parametrize("data,expected", [
     pytest.param({}, [], id='empty'),
     pytest.param(
-        {'tasks': ['task-1', 'task-2', 'task-3']},
+        {'tasks': {'task-1': 0.9, 'task-2': 0.1, 'task-3': 0.5}},
         ['task-2'],
         id='only tasks without test manifests selected'
     ),
     pytest.param(
-        {'groups': ['foo/test.ini']},
+        {'groups': {'foo/test.ini': 0.4}},
         ['task-0'],
         id='tasks containing group selected',
     ),
     pytest.param(
+        {'tasks': {'task-2': 0.2}, 'groups': {'foo/test.ini': 0.25, 'bar/test.ini': 0.75}},
+        ['task-0', 'task-1', 'task-2'],
+        id='tasks matching "tasks" or "groups" selected'),
+    pytest.param(
         {'tasks': ['task-2'], 'groups': ['foo/test.ini', 'bar/test.ini']},
         ['task-0', 'task-1', 'task-2'],
-        id='tasks matching "tasks" or "groups" selected'),
+        id='test old format'),
 ])
 def test_bugbug_push_schedules(responses, params, tasks, data, expected):
     query = "/push/{branch}/{head_rev}/schedules".format(**params)
     url = BugBugPushSchedules.BUGBUG_BASE_URL + query
 
     responses.add(
         responses.GET,
         url,