Bug 1302831 - Downloading parameters.yml in the action task. r=dustin
authorKalpesh Krishna <kalpeshk2011@gmail.com>
Thu, 15 Sep 2016 02:09:06 +0530
changeset 314250 53afd8b15130a1ab47f360adff89e01914e895d4
parent 314249 1c708062f8705e9ff1fb1689c9d47b90228a7344
child 314251 fda5c90a13da5a68b46c8b085ae1eeec0852c405
push id30713
push userkwierso@gmail.com
push dateFri, 16 Sep 2016 21:32:12 +0000
treeherdermozilla-central@b401cb17167b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1302831 - Downloading parameters.yml in the action task. r=dustin MozReview-Commit-ID: IbAXfHBylAm
--- a/taskcluster/taskgraph/action.py
+++ b/taskcluster/taskgraph/action.py
@@ -4,16 +4,17 @@
 # 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 json
 import logging
 import requests
+import yaml
 from .create import create_tasks
 from .decision import write_artifact
 from .parameters import Parameters
 from .optimize import optimize_task_graph
 from .taskgraph import TaskGraph
 logger = logging.getLogger(__name__)
@@ -28,29 +29,31 @@ def taskgraph_action(options):
      * creating taskgraph of tasks asked for in parameters with respect to
      a given gecko decision task and schedule these jobs.
     parameters = get_action_parameters(options)
     decision_task_id = parameters['decision_id']
     # read in the full graph for reference
     full_task_json = get_artifact(decision_task_id, "public/full-task-graph.json")
+    decision_params = get_artifact(decision_task_id, "public/parameters.yml")
     all_tasks, full_task_graph = TaskGraph.from_json(full_task_json, options['root'])
     target_tasks = set(parameters['task_labels'].split(','))
     target_graph = full_task_graph.graph.transitive_closure(target_tasks)
     target_task_graph = TaskGraph(
         {l: all_tasks[l] for l in target_graph.nodes},
     existing_tasks = get_artifact(decision_task_id, "public/label-to-taskid.json")
     # We don't want to optimize target tasks since they have been requested by user
     # Hence we put `target_tasks under` `do_not_optimize`
     optimized_graph, label_to_taskid = optimize_task_graph(target_task_graph=target_task_graph,
+                                                           params=decision_params,
     # write out the optimized task graph to describe what will actually happen,
     # and the map of labels to taskids
     write_artifact('task-graph.json', optimized_graph.to_json())
     write_artifact('label-to-taskid.json', label_to_taskid)
     # actually create the graph
@@ -67,10 +70,13 @@ def get_action_parameters(options):
     ] if n in options}
     return Parameters(parameters)
 def get_artifact(task_id, path):
     url = TASKCLUSTER_QUEUE_URL + task_id + "/artifacts/" + path
     resp = requests.get(url=url)
-    artifact = json.loads(resp.text)
+    if path.endswith('.json'):
+        artifact = json.loads(resp.text)
+    elif path.endswith('.yml'):
+        artifact = yaml.load(resp.text)
     return artifact