gecko-dev/taskcluster/taskgraph/target_tasks.py
Dustin J. Mitchell ffca84ff7d Bug 1281004: Specify test tasks more flexibly; r=gps; r=gbrown
This introduces a completely new way of specifying test task in-tree,
completely replacing the old spider-web of YAML files.

The high-level view is this:

 - some configuration files are used to determine which test suites to run
   for each test platform, and against which build platforms

 - each test suite is then represented by a dictionary, and modified by a
   sequence of transforms, duplicating as necessary (e.g., chunks), until
   it becomes a task definition

The transforms allow sufficient generality to support just about any desired
configuration, with the advantage that common configurations are "easy" while
unusual configurations are supported but notable for their oddness (they
require a custom transform).

As of this commit, this system produces the same set of test graphs as the
existing YAML, modulo:

  - extra.treeherder.groupName -- this was not consistent in the YAML
  - extra.treeherder.build -- this is ignored by taskcluster-treeherder anyway
  - mozharness command argument order
  - boolean True values for environment variables are now the string "true"
  - metadata -- this is now much more consistent, with task name being the label

Testing of this commit demonstrates that it produces the same set of test tasks for
the following projects (those which had special cases defined in the YAML):

  - autoland
  - ash (*)
  - willow
  - mozilla-inbound
  - mozilla-central
  - try:
    -b do -p all -t all -u all
    -b d -p linux64,linux64-asan -u reftest -t none
    -b d -p linux64,linux64-asan -u reftest[x64] -t none[x64]

(*) this patch omits the linux64/debug tc-M-e10s(dt) test, which is enabled on
ash; ash will require a small changeset to re-enable this test.

IGNORE BAD COMMIT MESSAGES (because the hook flags try syntax!)

MozReview-Commit-ID: G34dg9f17Hq

--HG--
rename : taskcluster/taskgraph/kind/base.py => taskcluster/taskgraph/task/base.py
rename : taskcluster/taskgraph/kind/docker_image.py => taskcluster/taskgraph/task/docker_image.py
rename : taskcluster/taskgraph/kind/legacy.py => taskcluster/taskgraph/task/legacy.py
extra : rebase_source : 03e70902c2d3a297eb9e3ce852f8737c2550d5a6
extra : histedit_source : d4d9f4b192605af21f41d83495fc3c923759c3cb
2016-07-11 23:27:14 +00:00

77 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph import try_option_syntax
from taskgraph.util.attributes import attrmatch
BUILD_AND_TEST_KINDS = set([
'legacy', # builds
'desktop-test',
'android-test',
])
_target_task_methods = {}
def _target_task(name):
def wrap(func):
_target_task_methods[name] = func
return func
return wrap
def get_method(method):
"""Get a target_task_method to pass to a TaskGraphGenerator."""
return _target_task_methods[method]
@_target_task('from_parameters')
def target_tasks_from_parameters(full_task_graph, parameters):
"""Get the target task set from parameters['target_tasks']. This is
useful for re-running a decision task with the same target set as in an
earlier run, by copying `target_tasks.json` into `parameters.yml`."""
return parameters['target_tasks']
@_target_task('try_option_syntax')
def target_tasks_try_option_syntax(full_task_graph, parameters):
"""Generate a list of target tasks based on try syntax in
parameters['message'] and, for context, the full task graph."""
options = try_option_syntax.TryOptionSyntax(parameters['message'], full_task_graph)
return [t.label for t in full_task_graph.tasks.itervalues()
if options.task_matches(t.attributes)]
@_target_task('all_builds_and_tests')
def target_tasks_all_builds_and_tests(full_task_graph, parameters):
"""Trivially target all build and test tasks. This is used for
branches where we want to build "everyting", but "everything"
does not include uninteresting things like docker images"""
def filter(task):
return t.attributes.get('kind') in BUILD_AND_TEST_KINDS
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@_target_task('ash_tasks')
def target_tasks_ash_tasks(full_task_graph, parameters):
"""Special case for builds on ash."""
def filter(task):
# NOTE: on the ash branch, update taskcluster/ci/desktop-test/tests.yml to
# run the M-dt-e10s tasks
attrs = t.attributes
if attrs.get('kind') not in BUILD_AND_TEST_KINDS:
return False
if not attrmatch(attrs, build_platform=set([
'linux64',
'linux64-asan',
'linux64-pgo',
])):
return False
if not attrmatch(attrs, e10s=True):
return False
return True
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]