No bug: [taskgraph] Use `trust-domain` to determine what index routes to verify; r=dustin

Differential Revision: https://phabricator.services.mozilla.com/D14477

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2018-12-13 21:01:39 +00:00
Родитель 3587f96735
Коммит 710d91063a
3 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -252,7 +252,7 @@ class TaskGraphGenerator(object):
logger.info(
"Limiting kinds to {target_kind} and dependencies".format(
target_kind=self._target_kind))
kind_graph = kind_graph.transitive_closure({self._target_kind})
kind_graph = kind_graph.transitive_closure({self._target_kind, 'docker-image'})
logger.info("Generating full task set")
all_tasks = {}
@ -272,7 +272,7 @@ class TaskGraphGenerator(object):
full_task_set = TaskGraph(all_tasks, Graph(set(all_tasks), set()))
self.verify_attributes(all_tasks)
self.verify_run_using()
yield verifications('full_task_set', full_task_set)
yield verifications('full_task_set', full_task_set, graph_config)
logger.info("Generating full task graph")
edges = set()
@ -284,7 +284,7 @@ class TaskGraphGenerator(object):
Graph(full_task_set.graph.nodes, edges))
logger.info("Full task graph contains %d tasks and %d dependencies" % (
len(full_task_set.graph.nodes), len(edges)))
yield verifications('full_task_graph', full_task_graph)
yield verifications('full_task_graph', full_task_graph, graph_config)
logger.info("Generating target task set")
target_task_set = TaskGraph(dict(all_tasks),
@ -300,7 +300,7 @@ class TaskGraphGenerator(object):
old_len - len(target_tasks),
len(target_tasks)))
yield verifications('target_task_set', target_task_set)
yield verifications('target_task_set', target_task_set, graph_config)
logger.info("Generating target task graph")
# include all docker-image build tasks here, in case they are needed for a graph morph
@ -316,7 +316,7 @@ class TaskGraphGenerator(object):
target_task_graph = TaskGraph(
{l: all_tasks[l] for l in target_graph.nodes},
target_graph)
yield verifications('target_task_graph', target_task_graph)
yield verifications('target_task_graph', target_task_graph, graph_config)
logger.info("Generating optimized task graph")
existing_tasks = parameters.get('existing_tasks')
@ -328,13 +328,13 @@ class TaskGraphGenerator(object):
do_not_optimize,
existing_tasks=existing_tasks)
yield verifications('optimized_task_graph', optimized_task_graph)
yield verifications('optimized_task_graph', optimized_task_graph, graph_config)
morphed_task_graph, label_to_taskid = morph(
optimized_task_graph, label_to_taskid, parameters)
yield 'label_to_taskid', label_to_taskid
yield verifications('morphed_task_graph', morphed_task_graph)
yield verifications('morphed_task_graph', morphed_task_graph, graph_config)
def _run_until(self, name):
while name not in self._run_results:

Просмотреть файл

@ -60,7 +60,7 @@ class WithFakeKind(TaskGraphGenerator):
def fake_load_graph_config(root_dir):
return {}
return {'trust-domain': 'test-domain'}
class FakeParameters(dict):

Просмотреть файл

@ -29,11 +29,11 @@ class VerificationSequence(object):
"""
_verifications = attr.ib(factory=dict)
def __call__(self, graph_name, graph):
def __call__(self, graph_name, graph, graph_config):
for verification in self._verifications.get(graph_name, []):
scratch_pad = {}
graph.for_each_task(verification, scratch_pad=scratch_pad)
verification(None, graph, scratch_pad=scratch_pad)
graph.for_each_task(verification, scratch_pad=scratch_pad, graph_config=graph_config)
verification(None, graph, scratch_pad=scratch_pad, graph_config=graph_config)
return graph_name, graph
def add(self, graph_name):
@ -78,7 +78,7 @@ def verify_docs(filename, identifiers, appearing_as):
@verifications.add('full_task_graph')
def verify_task_graph_symbol(task, taskgraph, scratch_pad):
def verify_task_graph_symbol(task, taskgraph, scratch_pad, graph_config):
"""
This function verifies that tuple
(collection.keys(), machine.platform, groupSymbol, symbol) is unique
@ -108,14 +108,13 @@ def verify_task_graph_symbol(task, taskgraph, scratch_pad):
@verifications.add('full_task_graph')
def verify_gecko_v2_routes(task, taskgraph, scratch_pad):
def verify_trust_domain_v2_routes(task, taskgraph, scratch_pad, graph_config):
"""
This function ensures that any two
tasks have distinct index.v2.routes
This function ensures that any two tasks have distinct ``index.{trust-domain}.v2`` routes.
"""
if task is None:
return
route_prefix = "index.gecko.v2"
route_prefix = "index.{}.v2".format(graph_config['trust-domain'])
task_dict = task.task
routes = task_dict.get('routes', [])
@ -131,7 +130,7 @@ def verify_gecko_v2_routes(task, taskgraph, scratch_pad):
@verifications.add('full_task_graph')
def verify_routes_notification_filters(task, taskgraph, scratch_pad):
def verify_routes_notification_filters(task, taskgraph, scratch_pad, graph_config):
"""
This function ensures that only understood filters for notifications are
specified.
@ -157,7 +156,7 @@ def verify_routes_notification_filters(task, taskgraph, scratch_pad):
@verifications.add('full_task_graph')
def verify_dependency_tiers(task, taskgraph, scratch_pad):
def verify_dependency_tiers(task, taskgraph, scratch_pad, graph_config):
tiers = scratch_pad
if task is not None:
tiers[task.label] = task.task.get('extra', {}) \
@ -184,7 +183,7 @@ def verify_dependency_tiers(task, taskgraph, scratch_pad):
@verifications.add('full_task_graph')
def verify_required_signoffs(task, taskgraph, scratch_pad):
def verify_required_signoffs(task, taskgraph, scratch_pad, graph_config):
"""
Task with required signoffs can't be dependencies of tasks with less
required signoffs.
@ -211,7 +210,7 @@ def verify_required_signoffs(task, taskgraph, scratch_pad):
@verifications.add('optimized_task_graph')
def verify_always_optimized(task, taskgraph, scratch_pad):
def verify_always_optimized(task, taskgraph, scratch_pad, graph_config):
"""
This function ensures that always-optimized tasks have been optimized.
"""