Bug 1383880: allow only one optimization per task; r=ahal

It is not at *all* clear how multiple optimizations for a single task should
interact. No simple logical operation is right in all cases, and in fact in
most imaginable cases the desired behavior turns out to be independent of all
but one of the optimizations. For example, given both `seta` and
`skip-unless-files-changed` optimizations, if SETA says to skip a test, it is
low value and should be skipped regardless of what files have changed. But if
SETA says to run a test, then it has likely been skipped in previous pushes, so
it should be run regardless of what has changed in this push.

This also adds a bit more output about optimization, that may be useful for
anyone wondering why a particular job didn't run.

MozReview-Commit-ID: 3OsvRnWjai4
This commit is contained in:
Dustin J. Mitchell
2017-08-01 20:02:59 +00:00
parent 76d985fb87
commit 18da9b3836
11 changed files with 118 additions and 100 deletions

View File

@@ -147,17 +147,19 @@ task_description_schema = Schema({
# tasks are never coalesced
Optional('coalesce-name'): basestring,
# Optimizations to perform on this task during the optimization phase,
# specified in order. These optimizations are defined in
# taskcluster/taskgraph/optimize.py.
Optional('optimizations'): [Any(
# search the index for the given index namespace, and replace this task if found
['index-search', basestring],
# Optimization to perform on this task during the optimization phase.
# Optimizations are defined in taskcluster/taskgraph/optimize.py.
Required('optimization', default=None): Any(
# always run this task (default)
None,
# search the index for the given index namespaces, and replace this task if found
# the search occurs in order, with the first match winning
{'index-search': [basestring]},
# consult SETA and skip this task if it is low-value
['seta'],
{'seta': None},
# skip this task if none of the given file patterns match
['skip-unless-changed', [basestring]],
)],
{'skip-unless-changed': [basestring]},
),
# the provisioner-id/worker-type for the task. The following parameters will
# be substituted in this string:
@@ -1162,7 +1164,7 @@ def build_task(config, tasks):
'task': task_def,
'dependencies': task.get('dependencies', {}),
'attributes': attributes,
'optimizations': task.get('optimizations', []),
'optimization': task.get('optimization', None),
}