rebuild_cached_tasks.py (1090B)
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 6 from .registry import register_callback_action 7 from .util import create_tasks, fetch_graph_and_labels 8 9 10 @register_callback_action( 11 name="rebuild-cached-tasks", 12 title="Rebuild Cached Tasks", 13 symbol="rebuild-cached", 14 description="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 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 )