Bug 1237739 - Use set and sort graph scopes; r=garndt
We're already casting the list of scopes to a set later. So we might as well use a set from the beginning. While we're here, sort the final value so output is more deterministic and easier to read. This sort shouldn't matter since the existing set() would have lost ordering.
This commit is contained in:
@@ -365,7 +365,7 @@ class Graph(object):
|
||||
# Task graph we are generating for taskcluster...
|
||||
graph = {
|
||||
'tasks': [],
|
||||
'scopes': []
|
||||
'scopes': set(),
|
||||
}
|
||||
|
||||
if params['revision_hash']:
|
||||
@@ -373,7 +373,7 @@ class Graph(object):
|
||||
route = 'queue:route:{}.{}'.format(
|
||||
routes_transform.TREEHERDER_ROUTES[env],
|
||||
treeherder_route)
|
||||
graph['scopes'].append(route)
|
||||
graph['scopes'].add(route)
|
||||
|
||||
graph['metadata'] = {
|
||||
'source': 'http://todo.com/what/goes/here',
|
||||
@@ -441,10 +441,10 @@ class Graph(object):
|
||||
))
|
||||
all_routes[route] = build_task['task']['metadata']['name']
|
||||
|
||||
graph['scopes'].append(define_task)
|
||||
graph['scopes'].extend(build_task['task'].get('scopes', []))
|
||||
graph['scopes'].add(define_task)
|
||||
graph['scopes'] |= set(build_task['task'].get('scopes', []))
|
||||
route_scopes = map(lambda route: 'queue:route:' + route, build_task['task'].get('routes', []))
|
||||
graph['scopes'].extend(route_scopes)
|
||||
graph['scopes'] |= set(route_scopes)
|
||||
|
||||
# Treeherder symbol configuration for the graph required for each
|
||||
# build so tests know which platform they belong to.
|
||||
@@ -539,10 +539,10 @@ class Graph(object):
|
||||
test_task['task']['workerType']
|
||||
)
|
||||
|
||||
graph['scopes'].append(define_task)
|
||||
graph['scopes'].extend(test_task['task'].get('scopes', []))
|
||||
graph['scopes'].add(define_task)
|
||||
graph['scopes'] |= set(test_task['task'].get('scopes', []))
|
||||
|
||||
graph['scopes'] = list(set(graph['scopes']))
|
||||
graph['scopes'] = sorted(graph['scopes'])
|
||||
|
||||
if params['print_names_only']:
|
||||
tIDs = defaultdict(list)
|
||||
|
||||
Reference in New Issue
Block a user