Bug 1532710: [taskgraph] Move default branch priorities to graph config; r=dustin
authorTom Prince <mozilla@hocat.ca>
Thu, 07 Mar 2019 04:20:36 +0000
changeset 520698 0db48ebeac0795acee5b84c8f133d77a6b74f4fb
parent 520697 281171d69172b03ff560d9a1702aeac9c5f35c66
child 520699 e892acedae44d507e24ddcf39e01b0cc94398722
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1532710
milestone67.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 1532710: [taskgraph] Move default branch priorities to graph config; r=dustin Differential Revision: https://phabricator.services.mozilla.com/D22127
taskcluster/ci/config.yml
taskcluster/taskgraph/config.py
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -241,8 +241,19 @@ partner-urls:
             default: null
             firefox:
                 by-release-type:
                     default: null
                     beta|release.*:
                         by-release-level:
                             production: 'git@github.com:mozilla-partners/mozilla-EME-free-manifest.git'
                             staging: 'git@github.com:moz-releng-automation-stage/mozilla-EME-free-manifest.git'
+
+
+task-priority:
+    by-project:
+        'mozilla-release': 'highest'
+        'mozilla-esr60': 'very-high'
+        'mozilla-beta': 'high'
+        'mozilla-central': 'medium'
+        'autoland': 'low'
+        'mozilla-inbound': 'low'
+        'default': 'very-low'
--- a/taskcluster/taskgraph/config.py
+++ b/taskcluster/taskgraph/config.py
@@ -53,28 +53,37 @@ graph_config_schema = Schema({
         }},
     },
     Required('scriptworker'): {
         # Prefix to add to scopes controlling scriptworkers
         Required('scope-prefix'): basestring,
         # Mapping of scriptworker types to scopes they accept
         Required('worker-types'): {basestring: [basestring]}
     },
+    Required('task-priority'): optionally_keyed_by('project', Any(
+        'highest',
+        'very-high',
+        'high',
+        'medium',
+        'low',
+        'very-low',
+        'lowest',
+    )),
     Required('partner-urls'): {
         Required('release-partner-repack'):
             optionally_keyed_by('release-product', 'release-level', 'release-type',
                                 Any(basestring, None)),
         Required('release-eme-free-repack'):
             optionally_keyed_by('release-product', 'release-level', 'release-type',
                                 Any(basestring, None)),
     },
 })
 
 
-@attr.s(frozen=True)
+@attr.s(frozen=True, cmp=False)
 class GraphConfig(object):
     _config = attr.ib()
     root_dir = attr.ib()
 
     def __getitem__(self, name):
         return self._config[name]
 
     @property
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -17,16 +17,17 @@ import time
 from copy import deepcopy
 
 from mozbuild.util import memoize
 from taskgraph.util.attributes import TRUNK_PROJECTS
 from taskgraph.util.hash import hash_path
 from taskgraph.util.treeherder import split_symbol
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.taskcluster import get_root_url
+from taskgraph.util.keyed_by import evaluate_keyed_by
 from taskgraph.util.schema import (
     validate_schema,
     Schema,
     optionally_keyed_by,
     resolve_keyed_by,
     OptimizationSchema,
     taskref_or_string,
 )
@@ -279,47 +280,25 @@ def get_branch_repo(config):
     return config.params['{}head_repository'.format(
         config.graph_config['project-repo-param-prefix'],
     )]
 
 
 COALESCE_KEY = '{project}.{job-identifier}'
 SUPERSEDER_URL = 'https://coalesce.mozilla-releng.net/v1/list/{age}/{size}/{key}'
 
-DEFAULT_BRANCH_PRIORITY = 'low'
-BRANCH_PRIORITIES = {
-    'mozilla-release': 'highest',
-    'comm-esr60': 'highest',
-    'mozilla-esr60': 'very-high',
-    'mozilla-beta': 'high',
-    'comm-beta': 'high',
-    'mozilla-central': 'medium',
-    'comm-central': 'medium',
-    'comm-aurora': 'medium',
-    'autoland': 'low',
-    'mozilla-inbound': 'low',
-    'try': 'very-low',
-    'try-comm-central': 'very-low',
-    'alder': 'very-low',
-    'ash': 'very-low',
-    'birch': 'very-low',
-    'cedar': 'very-low',
-    'cypress': 'very-low',
-    'elm': 'very-low',
-    'fig': 'very-low',
-    'gum': 'very-low',
-    'holly': 'very-low',
-    'jamun': 'very-low',
-    'larch': 'very-low',
-    'maple': 'very-low',
-    'oak': 'very-low',
-    'pine': 'very-low',
-    'graphics': 'very-low',
-    'ux': 'very-low',
-}
+
+@memoize
+def get_default_priority(graph_config, project):
+    return evaluate_keyed_by(
+        graph_config['task-priority'],
+        "Graph Config",
+        {'project': project}
+    )
+
 
 # define a collection of payload builders, depending on the worker implementation
 payload_builders = {}
 
 
 def payload_builder(name, schema):
     schema = Schema({Required('implementation'): name}).extend(schema)
 
@@ -1684,19 +1663,17 @@ def build_task(config, tasks):
         if 'deadline-after' not in task:
             task['deadline-after'] = '1 day'
 
         if 'coalesce' in task:
             key = coalesce_key(config, task)
             routes.append('coalesce.v1.' + key)
 
         if 'priority' not in task:
-            task['priority'] = BRANCH_PRIORITIES.get(
-                config.params['project'],
-                DEFAULT_BRANCH_PRIORITY)
+            task['priority'] = get_default_priority(config.graph_config, config.params['project'])
 
         tags = task.get('tags', {})
         tags.update({
             'createdForUser': config.params['owner'],
             'kind': config.kind,
             'label': task['label'],
         })