Bug 1316961 - Fix parameters for action tasks. r=dustin
authorBrian Stack <bstack@mozilla.com>
Mon, 14 Nov 2016 10:28:58 -0800
changeset 322908 11136ba1976d08a543112a97620bf9bb7bc3555f
parent 322907 e4334bf84ced87715b3c532a60f8613afcbb9d77
child 322909 654e7298c7fedc21659a824a75a4f5bf518f313c
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersdustin
bugs1316961
milestone53.0a1
Bug 1316961 - Fix parameters for action tasks. r=dustin MozReview-Commit-ID: 95xs7NRHSdi
taskcluster/taskgraph/action.py
--- a/taskcluster/taskgraph/action.py
+++ b/taskcluster/taskgraph/action.py
@@ -8,41 +8,39 @@ from __future__ import absolute_import, 
 
 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__)
 TASKCLUSTER_QUEUE_URL = "https://queue.taskcluster.net/v1/task/"
 
 
 def taskgraph_action(options):
     """
     Run the action task.  This function implements `mach taskgraph action-task`,
     and is responsible for
 
      * 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']
+    decision_task_id = options['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)
 
-    target_tasks = set(parameters['task_labels'].split(','))
+    target_tasks = set(options['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},
         target_graph)
 
     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
@@ -55,28 +53,16 @@ def taskgraph_action(options):
     # 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
     create_tasks(optimized_graph, label_to_taskid, decision_params)
 
 
-def get_action_parameters(options):
-    """
-    Load parameters from the command-line options for 'taskgraph action'.
-    """
-    parameters = {n: options[n] for n in [
-        'decision_id',
-        'task_labels',
-    ] 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)
     if path.endswith('.json'):
         artifact = json.loads(resp.text)
     elif path.endswith('.yml'):
         artifact = yaml.load(resp.text)
     return artifact