from_deps_task_name.py (866B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 from taskgraph.transforms.base import TransformSequence 6 from taskgraph.util.set_name import set_name_strip_kind 7 8 transforms = TransformSequence() 9 10 11 @transforms.add 12 def set_task_name(config, tasks): 13 # set the name of tasks created by the from_deps transforms by appending 14 # the primary dependency's label to the name from kind.yml 15 for task in tasks: 16 primary_kind = task["attributes"]["primary-kind-dependency"] 17 primary_dep = [dep for dep in config.kind_dependencies_tasks.values() if dep.label in task["dependencies"].values()][0] 18 task["name"] += f"-{set_name_strip_kind(config, [], primary_dep, primary_kind)}" 19 yield task