2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00
iceraven-browser/taskcluster/fenix_taskgraph/loader/__init__.py
Gregory Mierzwinski a457755388
Bug 1613483 - Add all Browsertime tests with visual metrics to Fenix repo. (#9087)
* Add visual-metrics docker type.

* Add required browsertime toolchain fetches.

* Add browsertime tests for technical and visual metrics.

* Run browsertime tests in a cron task.

* Run visual metrics on all browsertime tests.

* Use spaces instead of tabs, and resolve visual-metric nits.

* Enable browsertime on pull request for testing.

* Restrict PR tests to amazon on browsertime.

* First attempt using multi_dep.

* Add a primary dependency to browsertime.

* Try by not popping.

* Debug prints.

* Make one grouping per browsertime task.

* Try without the multi_dep transform.

* Delete dependent-tasks in visual-metrics transformer.

* Update setuptools installed and copy run-on-tasks-for.

* Use get when getting run-on-tasks-for.

* Add new pinned requirements.

* Try it.

* Set run-on-tasks-for properly.

* Remove print statement.

* Remove single_dep loader, and print statements.

* Remove run-on-tasks-for testing setting.

* Restart testing, and set user to root in visual-metrics Docker.

* Remove testing settings.

* Remove fetch-content from Docker.

* Change attributes grouping method.

* Run all tests as a check.

* Undo testing changes, and fix a bad test name.
2020-03-17 18:21:41 +01:00

74 lines
1.8 KiB
Python

# 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
import copy
# Define a collection of group_by functions
GROUP_BY_MAP = {}
def group_by(name):
def wrapper(func):
GROUP_BY_MAP[name] = func
return func
return wrapper
def group_tasks(config, tasks):
group_by_fn = GROUP_BY_MAP[config['group-by']]
groups = group_by_fn(config, tasks)
for combinations in groups.itervalues():
dependencies = [copy.deepcopy(t) for t in combinations]
yield dependencies
@group_by('build-type')
def build_type_grouping(config, tasks):
groups = {}
kind_dependencies = config.get('kind-dependencies')
only_build_type = config.get('only-for-build-types')
for task in tasks:
if task.kind not in kind_dependencies:
continue
if only_build_type:
build_type = task.attributes.get('build-type')
if build_type not in only_build_type:
continue
build_type = task.attributes.get('build-type')
groups.setdefault(build_type, []).append(task)
return groups
@group_by('attributes')
def attributes_grouping(config, tasks):
groups = {}
kind_dependencies = config.get('kind-dependencies')
only_attributes = config.get('only-for-attributes')
for task in tasks:
if task.kind not in kind_dependencies:
continue
group_attr = None
if only_attributes:
if not any(attr in task.attributes for attr in only_attributes):
continue
else:
continue
groups.setdefault(task.label, []).append(task)
return groups