Bug 1592162 - Add merge loader. r=darktrojan
authorRob Lemley <rob@thunderbird.net>
Mon, 04 Nov 2019 15:32:14 -0500
changeset 28089 e1879be2884c38b18c329b59b2887cd516f0b4cd
parent 28088 404de6eddbe0d7bc4049b38e82845880a96e3b08
child 28090 fee24a698db44e38cf473a849d27398e83717989
push id16648
push usergeoff@darktrojan.net
push dateTue, 05 Nov 2019 04:20:12 +0000
treeherdercomm-central@fee24a698db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1592162
Bug 1592162 - Add merge loader. r=darktrojan Facilitates loading a single task kind from both mozilla and comm repositories. So far it works with fetch tasks.
taskcluster/comm_taskgraph/loader/merge.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/comm_taskgraph/loader/merge.py
@@ -0,0 +1,31 @@
+# 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.loader.transform import loader as transform_loader
+from comm_taskgraph.loader.reference import loader as reference_loader
+
+
+def loader(kind, path, config, params, loaded_tasks):
+    """
+    Look up jobs via reference loader at reference-base-path using the list
+    reference-jobs-from, followed by jobs-from.
+
+    This loader has been tested with "fetch" jobs successfully. Anything else
+    is likely to have bugs.
+    """
+    # Make a copy of config for reference_loader. Use pop here to remove the
+    # fields that aren't used by the transform loader
+    reference_config = {'kind-dependencies': config.get('kind-dependencies',
+                                                        None),
+                        'base-path': config.pop('reference-base-path'),
+                        'jobs': config.pop('reference-jobs', None)
+                        }
+    for job in reference_loader(kind, path, reference_config, params,
+                                loaded_tasks):
+        yield job
+
+    for job in transform_loader(kind, path, config, params, loaded_tasks):
+        yield job