Debian Codegraph @

third_party/python/taskcluster_taskgraph/taskgraph/actions/rebuild_cached_tasks.py

raw
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 from .registry import register_callback_action
6 from .util import create_tasks, fetch_graph_and_labels
7
8
9 @register_callback_action(
10 name="rebuild-cached-tasks",
11 title="Rebuild Cached Tasks",
12 symbol="rebuild-cached",
13 description="Rebuild cached tasks.",
14 permission="rebuild-cached-tasks",
15 order=1000,
16 context=[],
17 )
18 def rebuild_cached_tasks_action(
19 parameters, graph_config, input, task_group_id, task_id
20 ):
21 decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
22 parameters, graph_config, task_group_id=task_group_id
23 )
24 cached_tasks = [
25 label
26 for label, task in full_task_graph.tasks.items()
27 if task.attributes.get("cached_task", False)
28 ]
29 if cached_tasks:
30 create_tasks(
31 graph_config,
32 cached_tasks,
33 full_task_graph,
34 label_to_taskid,
35 parameters,
36 decision_task_id,
37 )