Bug 1501878: [taskgraph] Verify that required signoffs propagate to dependent tasks; r=aki
authorTom Prince <mozilla@hocat.ca>
Tue, 20 Nov 2018 21:26:15 +0000
changeset 504079 9be16b2dee8ef88be9d3658c0d83c9d8f183a967
parent 504078 83c53808364e47579f90865081b2c284c2d4e231
child 504080 24c9ee68f82f94fb3a0a0b78cde4abddd85bdf3e
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1501878
milestone65.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 1501878: [taskgraph] Verify that required signoffs propagate to dependent tasks; r=aki Differential Revision: https://phabricator.services.mozilla.com/D12041
taskcluster/taskgraph/util/verify.py
--- a/taskcluster/taskgraph/util/verify.py
+++ b/taskcluster/taskgraph/util/verify.py
@@ -178,16 +178,43 @@ def verify_dependency_tiers(task, taskgr
                     continue
                 if tier < tiers[d]:
                     raise Exception(
                         '{} (tier {}) cannot depend on {} (tier {})'
                         .format(task.label, printable_tier(tier),
                                 d, printable_tier(tiers[d])))
 
 
+@verifications.add('full_task_graph')
+def verify_required_signoffs(task, taskgraph, scratch_pad):
+    """
+    Task with required signoffs can't be dependencies of tasks with less
+    required signoffs.
+    """
+    all_required_signoffs = scratch_pad
+    if task is not None:
+        all_required_signoffs[task.label] = set(task.attributes.get('required_signoffs', []))
+    else:
+        def printable_signoff(signoffs):
+            if len(signoffs) == 1:
+                return 'required signoff {}'.format(*signoffs)
+            elif signoffs:
+                return 'required signoffs {}'.format(', '.join(signoffs))
+            else:
+                return 'no required signoffs'
+        for task in taskgraph.tasks.itervalues():
+            required_signoffs = all_required_signoffs[task.label]
+            for d in task.dependencies.itervalues():
+                if required_signoffs < all_required_signoffs[d]:
+                    raise Exception(
+                        '{} ({}) cannot depend on {} ({})'
+                        .format(task.label, printable_signoff(required_signoffs),
+                                d, printable_signoff(all_required_signoffs[d])))
+
+
 @verifications.add('optimized_task_graph')
 def verify_always_optimized(task, taskgraph, scratch_pad):
     """
         This function ensures that always-optimized tasks have been optimized.
     """
     if task is None:
         return
     if task.task.get('workerType') == 'always-optimized':