Bug 1845715 - Check for failure when getting RegExp match result template r=iain
[gecko.git] / taskcluster / gecko_taskgraph / actions / raptor_extra_options.py
blob43b26d284d71e591f154aaba876b5f543ef02ccb
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/.
6 import logging
8 from taskgraph.util.taskcluster import get_task_definition
10 from .registry import register_callback_action
11 from .util import create_tasks, fetch_graph_and_labels
13 logger = logging.getLogger(__name__)
16 @register_callback_action(
17 title="Raptor Extra Options",
18 name="raptor-extra-options",
19 symbol="rxo",
20 description=(
21 "Allows the user to rerun raptor-browsertime tasks with additional arguments."
23 order=200,
24 context=[{"test-type": "raptor"}],
25 schema={
26 "type": "object",
27 "properties": {
28 "extra_options": {
29 "type": "string",
30 "default": "",
31 "description": "A space-delimited string of extra options "
32 "to be passed into a raptor-browsertime test."
33 "This also works with options with values, where the values "
34 "should be set as an assignment e.g. browser-cycles=3 "
35 "Passing multiple extra options could look something this: "
36 "`verbose browser-cycles=3` where the test runs with verbose "
37 "mode on and the browser cycles only 3 times.",
41 available=lambda parameters: True,
43 def raptor_extra_options_action(
44 parameters, graph_config, input, task_group_id, task_id
46 decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
47 parameters, graph_config
49 task = get_task_definition(task_id)
50 label = task["metadata"]["name"]
52 def modifier(task):
53 if task.label != label:
54 return task
56 if task.task["payload"]["env"].get("PERF_FLAGS"):
57 task.task["payload"]["env"]["PERF_FLAGS"] += " " + input.get(
58 "extra_options"
60 else:
61 task.task["payload"]["env"].setdefault(
62 "PERF_FLAGS", input.get("extra_options")
65 task.task["extra"]["treeherder"]["symbol"] += "-rxo"
66 task.task["extra"]["treeherder"]["groupName"] += " (extra options run)"
67 return task
69 create_tasks(
70 graph_config,
71 [label],
72 full_task_graph,
73 label_to_taskid,
74 parameters,
75 decision_task_id,
76 modifier=modifier,