Bug 1450012: [taskgraph] Make `retrigger-multiple` action selectively re-run tasks; r=dustin
authorTom Prince <mozilla@hocat.ca>
Tue, 16 Apr 2019 21:02:50 +0000
changeset 469732 c33e7bb2397c
parent 469731 43956eb12043
child 469733 a49a58dae129
push id35880
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 09:36:19 +0000
treeherdermozilla-central@79e6ed0b08d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1450012
milestone68.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 1450012: [taskgraph] Make `retrigger-multiple` action selectively re-run tasks; r=dustin Many tasks (release tasks and cached tasks, in particular) should be re-run rather than retriggered. Instead, make the `retrigger-multiple` action re-run them instead. Differential Revision: https://phabricator.services.mozilla.com/D27208
taskcluster/taskgraph/actions/retrigger.py
--- a/taskcluster/taskgraph/actions/retrigger.py
+++ b/taskcluster/taskgraph/actions/retrigger.py
@@ -193,16 +193,20 @@ def rerun_action(parameters, graph_confi
     label = task['metadata']['name']
     if task_id not in label_to_taskid.values():
         logger.error(
             "Refusing to rerun {}: taskId {} not in decision task {} label_to_taskid!".format(
                 label, task_id, decision_task_id
             )
         )
 
+    _rerun_task(task_id, label)
+
+
+def _rerun_task(task_id, label):
     status = taskcluster.status_task(task_id)
     if status not in RERUN_STATES:
         logger.warning(
             "No need to to rerun {}: state '{}' not in {}!".format(label, status, RERUN_STATES)
         )
         return
     taskcluster.rerun_task(task_id)
     logger.info('Reran {}'.format(label))
@@ -246,22 +250,37 @@ def rerun_action(parameters, graph_confi
 )
 def retrigger_multiple(parameters, graph_config, input, task_group_id, task_id):
     decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
         parameters, graph_config)
 
     suffixes = []
     for i, request in enumerate(input.get('requests', [])):
         times = request.get('times', 1)
+        rerun_tasks = [
+            label for label in request.get('tasks')
+            if not full_task_graph[label].attributes.get('retrigger')]
+        retrigger_tasks = [
+            label for label in request.get('tasks')
+            if full_task_graph[label].attributes.get('retrigger')
+        ]
+
+        for label in rerun_tasks:
+            # XXX we should not re-run tasks pulled in from other pushes
+            # In practice, this shouldn't matter, as only completed tasks
+            # are pulled in from other pushes and treeherder won't pass
+            # those labels.
+            _rerun_task(label_to_taskid[label], label)
+
         for j in xrange(times):
             suffix = '{}-{}'.format(i, j)
             suffixes.append(suffix)
             create_tasks(
                 graph_config,
-                request.get('tasks'),
+                retrigger_tasks,
                 full_task_graph,
                 label_to_taskid,
                 parameters,
                 decision_task_id,
                 suffix,
             )
 
     combine_task_graph_files(suffixes)