Bug 1286075: allow optimization of tasks whose dependencies have not been optimized; r=armenzg draft
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 07 Sep 2016 00:10:51 +0000
changeset 412726 efd297d37bd49dbe655266380641abc258dda725
parent 412725 58f1debe5219fc52ead2971718da932b63bb06d7
child 412727 335aafa96b395c9f801bde26ae53234f309aded0
push id29252
push userdmitchell@mozilla.com
push dateMon, 12 Sep 2016 19:16:39 +0000
reviewersarmenzg
bugs1286075, 1287018
milestone51.0a1
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),