add_talos.py (1719B)
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 import logging 7 8 from ..target_tasks import standard_filter 9 from .registry import register_callback_action 10 from .util import create_tasks, fetch_graph_and_labels 11 12 logger = logging.getLogger(__name__) 13 14 15 @register_callback_action( 16 name="run-all-talos", 17 title="Run All Talos Tests", 18 symbol="raT", 19 description="Add all Talos tasks to a push.", 20 order=150, 21 context=[], 22 schema={ 23 "type": "object", 24 "properties": { 25 "times": { 26 "type": "integer", 27 "default": 1, 28 "minimum": 1, 29 "maximum": 6, 30 "title": "Times", 31 "description": "How many times to run each task.", 32 } 33 }, 34 "additionalProperties": False, 35 }, 36 ) 37 def add_all_talos(parameters, graph_config, input, task_group_id, task_id): 38 decision_task_id, full_task_graph, label_to_taskid, _ = fetch_graph_and_labels( 39 parameters, graph_config 40 ) 41 42 times = input.get("times", 1) 43 for i in range(times): 44 to_run = [ 45 label 46 for label, entry in full_task_graph.tasks.items() 47 if "talos_try_name" in entry.attributes 48 and standard_filter(entry, parameters) 49 ] 50 51 create_tasks( 52 graph_config, 53 to_run, 54 full_task_graph, 55 label_to_taskid, 56 parameters, 57 decision_task_id, 58 ) 59 logger.info(f"Scheduled {len(to_run)} talos tasks (time {i + 1}/{times})")