Commit 2e410866 authored by MozLando's avatar MozLando
Browse files

Merge #4745



4745: Fail complete tasks faster so bors errors out faster r=pocmo,mitchhenges a=JohanLorenzo
Co-authored-by: default avatarJohan Lorenzo <jlorenzo@mozilla.com>
parents abdcd18b d90ff0f1
......@@ -7,7 +7,7 @@ tasks:
- $let:
taskgraph:
branch: taskgraph
revision: 0c5a68749f9a7672a7e56604b69a7bd41b036614
revision: a3ab725d6e0b292389d5903623c68bb5f0122526
trustDomain: mobile
in:
$let:
......
......@@ -10,6 +10,8 @@ from taskgraph.transforms.base import TransformSequence
from taskgraph.util.treeherder import add_suffix
from taskgraph import MAX_DEPENDENCIES
# XXX Docker images may be added after this transform, so we allow one more dep to be added
MAX_REGULAR_DEPS = MAX_DEPENDENCIES - 1
transforms = TransformSequence()
......@@ -41,7 +43,7 @@ def add_dependencies(config, tasks):
for dep_label in dep_labels:
deps[dep_label] = dep_label
if len(deps) == MAX_DEPENDENCIES:
if len(deps) == MAX_REGULAR_DEPS:
chunked_task = build_task_definition(task, deps, count)
chunked_label = get_chunked_label(config, chunked_task)
chunked_labels[chunked_label] = chunked_label
......
# 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 copy import deepcopy
from taskgraph.transforms.base import TransformSequence
from taskgraph.util.treeherder import add_suffix
from taskgraph import MAX_DEPENDENCIES
transforms = TransformSequence()
@transforms.add
def fill_dependencies(config, tasks):
for task in tasks:
dependencies = ('<{}>'.format(dep) for dep in task['dependencies'].keys())
task['run']['command']['task-reference'] = task['run']['command']['task-reference'].format(
dependencies=' '.join(dependencies)
)
yield task
......@@ -12,15 +12,30 @@ kind-dependencies:
transforms:
- taskgraph.transforms.code_review:transforms
- ac_taskgraph.transforms.chunk:transforms
- ac_taskgraph.transforms.complete:transforms
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
code-review: true
worker-type: b-android
worker:
docker-image: {in-tree: base}
max-run-time: 600
requires: all-resolved
run:
command:
task-reference:
/builds/worker/checkouts/src/taskcluster/scripts/are_dependencies_completed.py {dependencies}
use-caches: false
using: run-task
jobs:
pr:
description: PR Summary Task
run-on-tasks-for: [github-pull-request]
worker-type: succeed
push:
description: Push Summary Task
run-on-tasks-for: [github-push]
worker-type: succeed
#!/usr/bin/env 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/.
import argparse
import taskcluster
import os
queue = taskcluster.Queue({
'rootUrl': os.environ.get('TASKCLUSTER_PROXY_URL', 'https://taskcluster.net'),
})
def check_all_dependencies_are_completed(dependencies_task_ids):
print('Fetching status of {} dependencies...'.format(len(dependencies_task_ids)))
# TODO Make this dict-comprehension async once we go Python 3
state_per_task_ids = {
task_id: queue.status(task_id)['status']['state']
for task_id in dependencies_task_ids
}
print('Statuses fetched.')
non_completed_tasks = {
task_id: state
for task_id, state in state_per_task_ids.iteritems()
if state != 'completed'
}
if non_completed_tasks:
raise ValueError('Some tasks are not completed: {}'.format(non_completed_tasks))
def main():
parser = argparse.ArgumentParser(
description='Errors out if one of the DEPENDENCY_TASK_ID does not have the Taskcluster status "completed"'
)
parser.add_argument(
'dependencies_task_ids', metavar='DEPENDENCY_TASK_ID', nargs='+',
help="The task ID of a dependency"
)
result = parser.parse_args()
check_all_dependencies_are_completed(result.dependencies_task_ids)
print('All dependencies are completed. Reporting a green task!')
exit(0)
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment