commit ed4a40474e4c131d19f7146a37964fbd935fc3e0
parent cddf9eb9589b27b1ff1e27269062ff1c90978236
Author: Julien Cristau <jcristau@mozilla.com>
Date: Thu, 9 Oct 2025 07:53:15 +0000
Bug 1993289 - use task_duplicates in retrigger-multiple action. r=taskgraph-reviewers,releng-reviewers,bhearsum
Instead of looping over all `requests` and `times` in the action input,
and calling `create_tasks` in each iteration, set the `task_duplicates`
attribute on tasks to be retriggered, and call `create_tasks` just once
at the end. That means we don't have to deal with suffixes for
artifacts, we only copy the full graph and run optimizations once.
Differential Revision: https://phabricator.services.mozilla.com/D267983
Diffstat:
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/actions/retrigger.py b/taskcluster/gecko_taskgraph/actions/retrigger.py
@@ -14,7 +14,6 @@ from gecko_taskgraph.util.taskcluster import state_task
from .registry import register_callback_action
from .util import (
- combine_task_graph_files,
create_task_from_def,
create_tasks,
fetch_graph_and_labels,
@@ -270,20 +269,22 @@ def retrigger_multiple(parameters, graph_config, input, task_group_id, task_id):
label_to_taskids,
) = fetch_graph_and_labels(parameters, graph_config)
- suffixes = []
- for i, request in enumerate(input.get("requests", [])):
- times = request.get("times", 1)
+ def modifier(task):
+ for request in input.get("requests", []):
+ if task.attributes.get("retrigger", False) and task.label in request.get(
+ "tasks"
+ ):
+ task.attributes["task_duplicates"] = request.get("times", 1)
+ return task
+
+ retrigger_tasks = []
+
+ for request in input.get("requests", []):
rerun_tasks = [
label
for label in request.get("tasks")
if not _should_retrigger(full_task_graph, label)
]
- retrigger_tasks = [
- label
- for label in request.get("tasks")
- if _should_retrigger(full_task_graph, label)
- ]
-
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
@@ -292,19 +293,21 @@ def retrigger_multiple(parameters, graph_config, input, task_group_id, task_id):
for rerun_taskid in label_to_taskids[label]:
_rerun_task(rerun_taskid, label)
- for j in range(times):
- suffix = f"{i}-{j}"
- suffixes.append(suffix)
- create_tasks(
- graph_config,
- retrigger_tasks,
- full_task_graph,
- label_to_taskid,
- parameters,
- decision_task_id,
- suffix,
- action_tag="retrigger-multiple-task",
- )
-
- if suffixes:
- combine_task_graph_files(suffixes)
+ retrigger_tasks.extend(
+ [
+ label
+ for label in request.get("tasks")
+ if _should_retrigger(full_task_graph, label)
+ ]
+ )
+
+ create_tasks(
+ graph_config,
+ retrigger_tasks,
+ full_task_graph,
+ label_to_taskid,
+ parameters,
+ decision_task_id,
+ modifier=modifier,
+ action_tag="retrigger-multiple-task",
+ )