Bug 1352113 - Shippable Builds - Refactor SETA old->new handling a bit, to make it clearer. r=jmaher
authorJustin Wood <Callek@gmail.com>
Fri, 22 Mar 2019 03:24:38 +0000
changeset 465609 fa9cc5631313c33c998499fecfa53eb0d17a57bb
parent 465608 ea10d6f3474435f0d592cdd6e6dc15b251d50dbd
child 465610 a734011ca98edf5fe6e843b214e7aafc8e21d27b
push id35744
push userapavel@mozilla.com
push dateFri, 22 Mar 2019 16:44:08 +0000
treeherdermozilla-central@e66a2b59914d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1352113
milestone68.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 1352113 - Shippable Builds - Refactor SETA old->new handling a bit, to make it clearer. r=jmaher Differential Revision: https://phabricator.services.mozilla.com/D22238
taskcluster/taskgraph/util/seta.py
--- a/taskcluster/taskgraph/util/seta.py
+++ b/taskcluster/taskgraph/util/seta.py
@@ -92,51 +92,51 @@ class SETA(object):
 
             # hack seta to treat all Android Raptor tasks as low value - see Bug 1535016
             def only_android_raptor(task):
                 return task.startswith('test-android') and 'raptor' in task
 
             high_value_android_tasks = list(filter(only_android_raptor, high_value_tasks))
             low_value_tasks.extend(high_value_android_tasks)
 
-            opt = ['test-windows10-64/opt',
-                   'test-windows7-32/opt',
-                   'test-linux64/opt',
-                   'test-windows10-64-qr/opt',
-                   'test-windows7-32-qr/opt',
-                   'test-linux64-qr/opt']
-            pgo = ['test-windows10-64-pgo/opt',
-                   'test-windows7-32-pgo/opt',
-                   'test-linux64-pgo/opt',
-                   'test-windows10-64-pgo-qr/opt',
-                   'test-windows7-32-pgo-qr/opt',
-                   'test-linux64-pgo-qr/opt']
-            # Now add pgo variants to the low-value set
-            for iter in range(0, len(opt)):
-                if any(t.startswith(opt[iter]) for t in low_value_tasks):
+            seta_conversions = {
+                # old: new
+                'test-linux64/opt': 'test-linux64-pgo/opt',
+                'test-linux64-qr/opt': 'test-linux64-pgo-qr/opt',
+                'test-windows7-32/opt': 'test-windows7-32-pgo/opt',
+                'test-windows7-32-qr/opt': 'test-windows7-32-pgo-qr/opt',
+                'test-windows10-64/opt': 'test-windows10-64-pgo/opt',
+                'test-windows10-64-qr/opt': 'test-windows10-64-pgo-qr/opt',
+                }
+
+            # Now add new variants to the low-value set
+            for old, new in seta_conversions.iteritems():
+                if any(t.startswith(old) for t in low_value_tasks):
                     low_value_tasks.extend(
-                        [t.replace(opt[iter], pgo[iter]) for t in low_value_tasks]
+                        [t.replace(old, new) for t in low_value_tasks]
                     )
             # ... and the high value list
-            for iter in range(0, len(opt)):
-                if any(t.startswith(opt[iter]) for t in high_value_tasks):
+            for old, new in seta_conversions.iteritems():
+                if any(t.startswith(old) for t in high_value_tasks):
                     high_value_tasks.extend(
-                        [t.replace(opt[iter], pgo[iter]) for t in high_value_tasks]
+                        [t.replace(old, new) for t in high_value_tasks]
                     )
 
-            def pgo_as_opt_is_high_value(label):
-                for iter in range(0, len(opt)):
-                    if label.startswith(pgo[iter]):
-                        opt_label = label.replace(pgo[iter], opt[iter])
-                        if opt_label in high_value_tasks:
+            def new_as_old_is_high_value(label):
+                # This doesn't care if there are multiple old values for one new
+                # it will always check every old value.
+                for old, new in seta_conversions.iteritems():
+                    if label.startswith(new):
+                        old_label = label.replace(new, old)
+                        if old_label in high_value_tasks:
                             return True
                 return False
 
             # Now rip out from low value things that were high value in opt
-            low_value_tasks = [x for x in low_value_tasks if not pgo_as_opt_is_high_value(x)]
+            low_value_tasks = [x for x in low_value_tasks if not new_as_old_is_high_value(x)]
 
             # ensure no build tasks slipped in, we never want to optimize out those
             low_value_tasks = [x for x in low_value_tasks if 'build' not in x]
 
         # In the event of request times out, requests will raise a TimeoutError.
         except exceptions.Timeout:
             logger.warning("SETA timeout, we will treat all test tasks as high value.")