Bug 1286075: allow optimization of tasks whose dependencies have not been optimized; r=armenzg
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 07 Sep 2016 00:10:51 +0000
changeset 313686 1627fd341fc154d4fb771366676b7101204362df
parent 313685 21431cc1ab82f023059b7c552ca87ce4d71b4220
child 313687 108fe94daec368f5a04c86633d6b8ffe347837cc
push id30695
push userryanvm@gmail.com
push dateWed, 14 Sep 2016 00:45:02 +0000
treeherdermozilla-central@82d0a583a9a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1286075, 1287018
milestone51.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 1286075: allow optimization of tasks whose dependencies have not been optimized; r=armenzg MikeLing initially did this in bug 1287018. The intent of this conditional was to make optimization faster by not even checking most tasks, based on the assumption that if the prerequisite to a task has changed (for example, a docker image or a build), then naturally we will want to execute that task. However, as we have developed actual optimization methods, this has proven not to be the case: we might want to optimize a test out if its inputs have not changed, even if a new installer has been built. Similarly, SETA may optimize tasks out even if their inputs have changed. MozReview-Commit-ID: LgHET3Z84GB
taskcluster/taskgraph/optimize.py
taskcluster/taskgraph/test/test_optimize.py
--- a/taskcluster/taskgraph/optimize.py
+++ b/taskcluster/taskgraph/optimize.py
@@ -83,19 +83,16 @@ def annotate_task_graph(target_task_grap
                 raise Exception(
                     "task {} was optimized away, but {} depends on it".format(
                         t.label, label))
 
         # if this task is blacklisted, don't even consider optimizing
         replacement_task_id = None
         if label in do_not_optimize:
             optimized = False
-        # if any dependencies can't be optimized, this task can't, either
-        elif any(not t.optimized for t in dependencies):
-            optimized = False
         # Let's check whether this task has been created before
         elif existing_tasks is not None and label in existing_tasks:
             optimized = True
             replacement_task_id = existing_tasks[label]
         # otherwise, examine the task itself (which may be an expensive operation)
         else:
             optimized, replacement_task_id = task.optimize()
 
--- a/taskcluster/taskgraph/test/test_optimize.py
+++ b/taskcluster/taskgraph/test/test_optimize.py
@@ -137,33 +137,33 @@ class TestOptimize(unittest.TestCase):
                             graph.graph.named_links_dict(), label_to_taskid, None)
         self.assert_annotations(
             graph,
             task1=(False, None),
             task2=(False, None)
         )
         self.assertEqual
 
-    def test_annotate_task_graph_nos_propagate(self):
-        "annotating marks a task with a non-optimized dependency as non-optimized"
+    def test_annotate_task_graph_nos_do_not_propagate(self):
+        "a task with a non-optimized dependency can be optimized"
         OptimizingTask.optimize = \
             lambda self: (False, None) if self.label == 'task1' else (True, 'taskid')
         graph = self.make_graph(
             self.make_task('task1'),
             self.make_task('task2'),
             self.make_task('task3'),
             ('task2', 'task1', 'build'),
             ('task2', 'task3', 'image'),
         )
         annotate_task_graph(graph, set(),
                             graph.graph.named_links_dict(), {}, None)
         self.assert_annotations(
             graph,
             task1=(False, None),
-            task2=(False, None),  # kind would have returned (True, 'taskid') here
+            task2=(True, 'taskid'),
             task3=(True, 'taskid')
         )
 
     def test_get_subgraph_single_dep(self):
         "when a single dependency is optimized, it is omitted from the graph"
         graph = self.make_graph(
             self.make_task('task1', optimized=True, task_id='dep1'),
             self.make_task('task2', optimized=False),