Bug 1364421 - Allow BBB jobs to be backfilled r=garndt
authorBrian Stack <bstack@mozilla.com>
Fri, 19 May 2017 11:38:17 -0700
changeset 359714 1cd72f93f1550cb738fd280e73096911abdaddd6
parent 359713 63badf94749316cd9b1e809be9637337084bb0cb
child 359715 ffd4de6a7326a3a084f666dd0fe76c73958ddd48
push id31854
push userarchaeopteryx@coole-files.de
push dateSat, 20 May 2017 16:46:00 +0000
treeherdermozilla-central@51736db67723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgarndt
bugs1364421
milestone55.0a1
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 1364421 - Allow BBB jobs to be backfilled r=garndt MozReview-Commit-ID: 1CWRd4YUISc
taskcluster/taskgraph/action.py
--- a/taskcluster/taskgraph/action.py
+++ b/taskcluster/taskgraph/action.py
@@ -70,29 +70,35 @@ def backfill(project, job_id):
      * Scheduling backfill jobs from a given treeherder resultset backwards until either
      a successful job is found or `N` jobs have been scheduled.
     """
     s = requests.Session()
     s.headers.update({"User-Agent": "gecko-intree-backfill-task"})
 
     job = s.get(url="{}/project/{}/jobs/{}/".format(TREEHERDER_URL, project, job_id)).json()
 
-    if job["build_system_type"] != "taskcluster":
-        logger.warning("Invalid build system type! Must be a Taskcluster job. Aborting.")
-        return
+    job_type_name = job['job_type_name']
+
+    if job['build_system_type'] != 'taskcluster':
+        if 'Created by BBB for task' not in job['reason']:
+            logger.warning("Invalid build system type! Must be a Taskcluster job. Aborting.")
+            return
+        task_id = job['reason'].split(' ')[-1]
+        task = requests.get("https://queue.taskcluster.net/v1/task/{}".format(task_id)).json()
+        job_type_name = task['metadata']['name']
 
     filters = dict((k, job[k]) for k in ("build_platform_id", "platform_option", "job_type_id"))
 
     resultset_url = "{}/project/{}/resultset/".format(TREEHERDER_URL, project)
     params = {"id__lt": job["result_set_id"], "count": MAX_BACKFILL_RESULTSETS}
     results = s.get(url=resultset_url, params=params).json()["results"]
     resultsets = [resultset["id"] for resultset in results]
 
     for decision in load_decisions(s, project, resultsets, filters):
-        add_tasks(decision, [job["job_type_name"]], '{}-'.format(decision))
+        add_tasks(decision, [job_type_name], '{}-'.format(decision))
 
 
 def add_talos(decision_task_id, times=1):
     """
     Run the add-talos task.  This function implements `mach taskgraph add-talos`,
     and is responsible for
 
      * Adding all talos jobs to a push.