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 5from __future__ import absolute_import, print_function, unicode_literals 6 7from taskgraph.loader.transform import loader as transform_loader 8from comm_taskgraph.loader.reference import loader as reference_loader 9 10 11def loader(kind, path, config, params, loaded_tasks): 12 """ 13 Look up jobs via reference loader at reference-base-path using the list 14 reference-jobs-from, followed by jobs-from. 15 16 This loader has been tested with "fetch" jobs successfully. Anything else 17 is likely to have bugs. 18 """ 19 # Make a copy of config for reference_loader. Use pop here to remove the 20 # fields that aren't used by the transform loader 21 reference_config = { 22 "kind-dependencies": config.get("kind-dependencies", None), 23 "base-path": config.pop("reference-base-path"), 24 "jobs": config.pop("reference-jobs", None), 25 } 26 for job in reference_loader(kind, path, reference_config, params, loaded_tasks): 27 yield job 28 29 for job in transform_loader(kind, path, config, params, loaded_tasks): 30 yield job 31