Bug 1364266 - Specify task priority within task definition r=dustin
authorGregory Arndt <garndt@mozilla.com>
Fri, 05 May 2017 15:22:03 -0500
changeset 360377 5a676e5924b68ad90da251c70fa9ea776b5cfe2f
parent 360376 4fc25ea324cae8d5534581a9d9213aa3df232e7b
child 360378 1d58c6daabeda497d1505f7af1fc61baa0e3e6d5
push id90653
push userdmitchell@mozilla.com
push dateWed, 24 May 2017 14:43:24 +0000
treeherdermozilla-inbound@5a676e5924b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1364266
milestone55.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 1364266 - Specify task priority within task definition r=dustin Tasks should be assigned a priority based on the branch they originated from. It is important that certain branches receive preferential treatment, such as a release branch task being executed before a task from Try. Branch priority mirrors the priorities defined within buildbot. MozReview-Commit-ID: 8qR9F34lzzc
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -478,16 +478,52 @@ V2_L10N_TEMPLATES = [
 # the roots of the treeherder routes, keyed by treeherder environment
 TREEHERDER_ROUTE_ROOTS = {
     'production': 'tc-treeherder',
     'staging': 'tc-treeherder-stage',
 }
 
 COALESCE_KEY = 'builds.{project}.{name}'
 
+DEFAULT_BRANCH_PRIORITY = 'low'
+BRANCH_PRIORITIES = {
+    'mozilla-release': 'highest',
+    'comm-esr45': 'highest',
+    'comm-esr52': 'highest',
+    'mozilla-esr45': 'very-high',
+    'mozilla-esr52': 'very-high',
+    'mozilla-beta': 'high',
+    'comm-beta': 'high',
+    'mozilla-central': 'medium',
+    'comm-central': 'medium',
+    'mozilla-aurora': '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',
+    'date': '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',
+}
+
 # define a collection of payload builders, depending on the worker implementation
 payload_builders = {}
 
 
 def payload_builder(name):
     def wrap(func):
         payload_builders[name] = func
         return func
@@ -916,16 +952,21 @@ def build_task(config, tasks):
             task['deadline-after'] = '1 day'
 
         if 'coalesce-name' in task and int(config.params['level']) > 1:
             key = COALESCE_KEY.format(
                 project=config.params['project'],
                 name=task['coalesce-name'])
             routes.append('coalesce.v1.' + key)
 
+        if 'priority' not in task:
+            task['priority'] = BRANCH_PRIORITIES.get(
+                config.params['project'],
+                DEFAULT_BRANCH_PRIORITY)
+
         tags = task.get('tags', {})
         tags.update({'createdForUser': config.params['owner']})
 
         task_def = {
             'provisionerId': provisioner_id,
             'workerType': worker_type,
             'routes': routes,
             'created': {'relative-datestamp': '0 seconds'},
@@ -938,16 +979,17 @@ def build_task(config, tasks):
                 'owner': config.params['owner'],
                 'source': '{}/file/{}/{}'.format(
                     config.params['head_repository'],
                     config.params['head_rev'],
                     config.path),
             },
             'extra': extra,
             'tags': tags,
+            'priority': task['priority'],
         }
 
         if task_th:
             # link back to treeherder in description
             th_push_link = 'https://treeherder.mozilla.org/#/jobs?repo={}&revision={}'.format(
                 config.params['project'], config.params['head_rev'])
             task_def['metadata']['description'] += ' ([Treeherder push]({}))'.format(
                 th_push_link)