Bug 1316077 part 2: remove taskcluster scheduler from mozharness. r=jlund draft
authorWander Lairson Costa <wcosta@mozilla.com>
Fri, 18 Nov 2016 16:52:16 -0200
changeset 441342 76ad3993d50cb3dccca6b56652eec9568f5e5abb
parent 441341 ede38a683abdf411612e885f6985c79b0532cb46
child 441343 e0251636e8e55613d58e743d70469e6b1a2175a5
push id36397
push userwcosta@mozilla.com
push dateFri, 18 Nov 2016 18:52:45 +0000
reviewersjlund
bugs1316077
milestone53.0a1
Bug 1316077 part 2: remove taskcluster scheduler from mozharness. r=jlund taskcluster-scheduler is deprecated. mozharness uses it to get the task graph in order to discover the parent of a task. We now use queue to get the task definition, which contains the 'requires' field. MozReview-Commit-ID: 8IivfxLvxVA
testing/mozharness/mozharness/mozilla/taskcluster_helper.py
--- a/testing/mozharness/mozharness/mozilla/taskcluster_helper.py
+++ b/testing/mozharness/mozharness/mozilla/taskcluster_helper.py
@@ -1,14 +1,15 @@
 """Taskcluster module. Defines a few helper functions to call into the taskcluster
    client.
 """
 import os
 from datetime import datetime, timedelta
 from urlparse import urljoin
+from mozharness.base.log import INFO
 
 from mozharness.base.log import LogMixin
 
 
 # Taskcluster {{{1
 class Taskcluster(LogMixin):
     """
     Helper functions to report data to Taskcluster
@@ -157,17 +158,16 @@ class Taskcluster(LogMixin):
             os.path.basename(filename)
         )
 
 
 # TasckClusterArtifactFinderMixin {{{1
 class TaskClusterArtifactFinderMixin(object):
     # This class depends that you have extended from the base script
     QUEUE_URL = 'https://queue.taskcluster.net/v1/task/'
-    SCHEDULER_URL = 'https://scheduler.taskcluster.net/v1/task-graph/'
 
     def get_task(self, task_id):
         """ Get Task Definition """
         # Signature: task(taskId) : result
         return self.load_json_url(urljoin(self.QUEUE_URL, task_id))
 
     def get_list_latest_artifacts(self, task_id):
         """ Get Artifacts from Latest Run """
@@ -176,32 +176,22 @@ class TaskClusterArtifactFinderMixin(obj
         # Notice that this grabs the most recent run of a task since we don't
         # know the run_id. This slightly slower, however, it is more convenient
         return self.load_json_url(urljoin(self.QUEUE_URL, '{}/artifacts'.format(task_id)))
 
     def url_to_artifact(self, task_id, full_path):
         """ Return a URL for an artifact. """
         return urljoin(self.QUEUE_URL, '{}/artifacts/{}'.format(task_id, full_path))
 
-    def get_inspect_graph(self, task_group_id):
-        """ Inspect Task Graph """
-        # Signature: inspect(taskGraphId) : result
-        return self.load_json_url(urljoin(self.SCHEDULER_URL, '{}/inspect'.format(task_group_id)))
-
     def find_parent_task_id(self, task_id):
         """ Returns the task_id of the parent task associated to the given task_id."""
         # Find group id to associated to all related tasks
-        task_group_id = self.get_task(task_id)['taskGroupId']
-
-        # Find child task and determine on which task it depends on
-        for task in self.get_inspect_graph(task_group_id)['tasks']:
-            if task['taskId'] == task_id:
-                parent_task_id = task['requires'][0]
-
-        return parent_task_id
+        task = self.load_json_url(urljoin(self.QUEUE_URL, task_id))
+        self.log('Task dependencies: {}'.format(' '.join(task['dependencies'])))
+        return task['dependencies'][0]
 
     def set_bbb_artifacts(self, task_id, properties_file_path):
         """ Find BBB artifacts through properties_file_path and set them. """
         p = self.load_json_url(
             self.url_to_artifact(task_id, properties_file_path))['properties']
 
         # Set importants artifacts for test jobs
         self.set_artifacts(