Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 24f4ed9

Browse files
committed
Bug 1532710: [taskgraph] Move default branch priorities to graph config; r=dustin
Differential Revision: https://phabricator.services.mozilla.com/D22127 --HG-- extra : moz-landing-system : lando
1 parent 9203300 commit 24f4ed9

File tree

3 files changed

+32
-35
lines changed

3 files changed

+32
-35
lines changed

taskcluster/ci/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,14 @@ partner-urls:
246246
by-release-level:
247247
production: '[email protected]:mozilla-partners/mozilla-EME-free-manifest.git'
248248
staging: '[email protected]:moz-releng-automation-stage/mozilla-EME-free-manifest.git'
249+
250+
251+
task-priority:
252+
by-project:
253+
'mozilla-release': 'highest'
254+
'mozilla-esr60': 'very-high'
255+
'mozilla-beta': 'high'
256+
'mozilla-central': 'medium'
257+
'autoland': 'low'
258+
'mozilla-inbound': 'low'
259+
'default': 'very-low'

taskcluster/taskgraph/config.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@
5858
# Mapping of scriptworker types to scopes they accept
5959
Required('worker-types'): {basestring: [basestring]}
6060
},
61+
Required('task-priority'): optionally_keyed_by('project', Any(
62+
'highest',
63+
'very-high',
64+
'high',
65+
'medium',
66+
'low',
67+
'very-low',
68+
'lowest',
69+
)),
6170
Required('partner-urls'): {
6271
Required('release-partner-repack'):
6372
optionally_keyed_by('release-product', 'release-level', 'release-type',
@@ -69,7 +78,7 @@
6978
})
7079

7180

72-
@attr.s(frozen=True)
81+
@attr.s(frozen=True, cmp=False)
7382
class GraphConfig(object):
7483
_config = attr.ib()
7584
root_dir = attr.ib()

taskcluster/taskgraph/transforms/task.py

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from taskgraph.util.treeherder import split_symbol
2323
from taskgraph.transforms.base import TransformSequence
2424
from taskgraph.util.taskcluster import get_root_url
25+
from taskgraph.util.keyed_by import evaluate_keyed_by
2526
from taskgraph.util.schema import (
2627
validate_schema,
2728
Schema,
@@ -284,37 +285,15 @@ def get_branch_repo(config):
284285
COALESCE_KEY = '{project}.{job-identifier}'
285286
SUPERSEDER_URL = 'https://coalesce.mozilla-releng.net/v1/list/{age}/{size}/{key}'
286287

287-
DEFAULT_BRANCH_PRIORITY = 'low'
288-
BRANCH_PRIORITIES = {
289-
'mozilla-release': 'highest',
290-
'comm-esr60': 'highest',
291-
'mozilla-esr60': 'very-high',
292-
'mozilla-beta': 'high',
293-
'comm-beta': 'high',
294-
'mozilla-central': 'medium',
295-
'comm-central': 'medium',
296-
'comm-aurora': 'medium',
297-
'autoland': 'low',
298-
'mozilla-inbound': 'low',
299-
'try': 'very-low',
300-
'try-comm-central': 'very-low',
301-
'alder': 'very-low',
302-
'ash': 'very-low',
303-
'birch': 'very-low',
304-
'cedar': 'very-low',
305-
'cypress': 'very-low',
306-
'elm': 'very-low',
307-
'fig': 'very-low',
308-
'gum': 'very-low',
309-
'holly': 'very-low',
310-
'jamun': 'very-low',
311-
'larch': 'very-low',
312-
'maple': 'very-low',
313-
'oak': 'very-low',
314-
'pine': 'very-low',
315-
'graphics': 'very-low',
316-
'ux': 'very-low',
317-
}
288+
289+
@memoize
290+
def get_default_priority(graph_config, project):
291+
return evaluate_keyed_by(
292+
graph_config['task-priority'],
293+
"Graph Config",
294+
{'project': project}
295+
)
296+
318297

319298
# define a collection of payload builders, depending on the worker implementation
320299
payload_builders = {}
@@ -1689,9 +1668,7 @@ def build_task(config, tasks):
16891668
routes.append('coalesce.v1.' + key)
16901669

16911670
if 'priority' not in task:
1692-
task['priority'] = BRANCH_PRIORITIES.get(
1693-
config.params['project'],
1694-
DEFAULT_BRANCH_PRIORITY)
1671+
task['priority'] = get_default_priority(config.graph_config, config.params['project'])
16951672

16961673
tags = task.get('tags', {})
16971674
tags.update({

0 commit comments

Comments
 (0)