Bug 1491307: make retrigger-mochitest its own action r=tomprince a=mochitest-retrigger-fix
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 14 Sep 2018 16:25:46 +0000
changeset 489855 dd935a08ff4a
parent 489854 6ad54436118a
child 489856 add9e41f85c2
push id9802
push userncsoregi@mozilla.com
push dateFri, 14 Sep 2018 19:50:13 +0000
treeherdermozilla-beta@dd935a08ff4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince, mochitest-retrigger-fix
bugs1491307
milestone63.0
Bug 1491307: make retrigger-mochitest its own action r=tomprince a=mochitest-retrigger-fix Even with no options, this is not a simple retrigger -- it adds voluminous debug output. So let's keep it as a custom action. Differential Revision: https://phabricator.services.mozilla.com/D5879
taskcluster/taskgraph/actions/retrigger.py
taskcluster/taskgraph/actions/retrigger_mochitest.py
--- a/taskcluster/taskgraph/actions/retrigger.py
+++ b/taskcluster/taskgraph/actions/retrigger.py
@@ -1,156 +1,33 @@
 # -*- coding: utf-8 -*-
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-import json
 import logging
 import textwrap
 
 from slugid import nice as slugid
 from .util import (
     combine_task_graph_files,
     create_tasks,
     fetch_graph_and_labels,
     relativize_datestamps,
     create_task_from_def,
 )
-from ..util.parameterization import resolve_task_references
 from .registry import register_callback_action
 
 logger = logging.getLogger(__name__)
 
 
 @register_callback_action(
-    name='retrigger',
-    cb_name='retrigger-mochitest',
-    title='Retrigger Mochitest/Reftest',
-    symbol='rt',
-    kind='hook',
-    generic=True,
-    description="Retriggers the specified mochitest/reftest job with additional options",
-    context=[{'test-type': 'mochitest'},
-             {'test-type': 'reftest'}],
-    order=10,
-    schema={
-        'type': 'object',
-        'properties': {
-            'path': {
-                'type': 'string',
-                'maxLength': 255,
-                'default': '',
-                'title': 'Path name',
-                'description': 'Path of test to retrigger'
-            },
-            'logLevel': {
-                'type': 'string',
-                'enum': ['debug', 'info', 'warning', 'error', 'critical'],
-                'default': 'debug',
-                'title': 'Log level',
-                'description': 'Log level for output (default is DEBUG, which is highest)'
-            },
-            'runUntilFail': {
-                'type': 'boolean',
-                'default': True,
-                'title': 'Run until failure',
-                'description': ('Runs the specified set of tests repeatedly '
-                                'until failure (or 30 times)')
-            },
-            'repeat': {
-                'type': 'integer',
-                'default': 30,
-                'minimum': 1,
-                'title': 'Run tests N times',
-                'description': ('Run tests repeatedly (usually used in '
-                                'conjunction with runUntilFail)')
-            },
-            'environment': {
-                'type': 'object',
-                'default': {'MOZ_LOG': ''},
-                'title': 'Extra environment variables',
-                'description': 'Extra environment variables to use for this run',
-                'additionalProperties': {'type': 'string'}
-            },
-            'preferences': {
-                'type': 'object',
-                'default': {'mygeckopreferences.pref': 'myvalue2'},
-                'title': 'Extra gecko (about:config) preferences',
-                'description': 'Extra gecko (about:config) preferences to use for this run',
-                'additionalProperties': {'type': 'string'}
-            }
-        },
-        'additionalProperties': False,
-        'required': ['path']
-    }
-)
-def mochitest_retrigger_action(parameters, graph_config, input, task_group_id, task_id, task):
-    decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
-        parameters, graph_config)
-
-    pre_task = full_task_graph.tasks[task['metadata']['name']]
-
-    # fix up the task's dependencies, similar to how optimization would
-    # have done in the decision
-    dependencies = {name: label_to_taskid[label]
-                    for name, label in pre_task.dependencies.iteritems()}
-    new_task_definition = resolve_task_references(pre_task.label, pre_task.task, dependencies)
-    new_task_definition.setdefault('dependencies', []).extend(dependencies.itervalues())
-
-    # don't want to run mozharness tests, want a custom mach command instead
-    new_task_definition['payload']['command'] += ['--no-run-tests']
-
-    custom_mach_command = [task['tags']['test-type']]
-
-    # mochitests may specify a flavor
-    if new_task_definition['payload']['env'].get('MOCHITEST_FLAVOR'):
-        custom_mach_command += [
-            '--keep-open=false',
-            '-f',
-            new_task_definition['payload']['env']['MOCHITEST_FLAVOR']
-        ]
-
-    enable_e10s = json.loads(new_task_definition['payload']['env'].get(
-        'ENABLE_E10S', 'true'))
-    if not enable_e10s:
-        custom_mach_command += ['--disable-e10s']
-
-    custom_mach_command += ['--log-tbpl=-',
-                            '--log-tbpl-level={}'.format(input.get('logLevel', 'debug'))]
-    if input.get('runUntilFail'):
-        custom_mach_command += ['--run-until-failure']
-    if input.get('repeat'):
-        custom_mach_command += ['--repeat', str(input.get('repeat', 30))]
-
-    # add any custom gecko preferences
-    for (key, val) in input.get('preferences', {}).iteritems():
-        custom_mach_command += ['--setpref', '{}={}'.format(key, val)]
-
-    custom_mach_command += [input['path']]
-    new_task_definition['payload']['env']['CUSTOM_MACH_COMMAND'] = ' '.join(
-        custom_mach_command)
-
-    # update environment
-    new_task_definition['payload']['env'].update(input.get('environment', {}))
-
-    # tweak the treeherder symbol
-    new_task_definition['extra']['treeherder']['symbol'] += '-custom'
-
-    logging.info("New task definition: %s", new_task_definition)
-
-    # actually create the new task
-    new_task_id = slugid()
-    create_task_from_def(new_task_id, new_task_definition, parameters['level'])
-
-
-@register_callback_action(
     title='Retrigger',
     name='retrigger',
     symbol='rt',
     kind='hook',
     cb_name='retrigger-decision',
     description=textwrap.dedent('''\
         Create a clone of the task (retriggering decision, action, and cron tasks requires
         special scopes).'''),
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/actions/retrigger_mochitest.py
@@ -0,0 +1,140 @@
+# -*- coding: utf-8 -*-
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import json
+import logging
+
+from slugid import nice as slugid
+from .util import (
+    fetch_graph_and_labels,
+    create_task_from_def,
+)
+from ..util.parameterization import resolve_task_references
+from .registry import register_callback_action
+
+logger = logging.getLogger(__name__)
+
+
+@register_callback_action(
+    name='retrigger-mochitest',
+    title='Retrigger Mochitest/Reftest with Debugging',
+    symbol='rt',
+    kind='hook',
+    generic=True,
+    description="Retriggers the specified mochitest/reftest job with additional options",
+    context=[{'test-type': 'mochitest'},
+             {'test-type': 'reftest'}],
+    order=10,
+    schema={
+        'type': 'object',
+        'properties': {
+            'path': {
+                'type': 'string',
+                'maxLength': 255,
+                'default': '',
+                'title': 'Path name',
+                'description': 'Path of test to retrigger'
+            },
+            'logLevel': {
+                'type': 'string',
+                'enum': ['debug', 'info', 'warning', 'error', 'critical'],
+                'default': 'debug',
+                'title': 'Log level',
+                'description': 'Log level for output (default is DEBUG, which is highest)'
+            },
+            'runUntilFail': {
+                'type': 'boolean',
+                'default': True,
+                'title': 'Run until failure',
+                'description': ('Runs the specified set of tests repeatedly '
+                                'until failure (or 30 times)')
+            },
+            'repeat': {
+                'type': 'integer',
+                'default': 30,
+                'minimum': 1,
+                'title': 'Run tests N times',
+                'description': ('Run tests repeatedly (usually used in '
+                                'conjunction with runUntilFail)')
+            },
+            'environment': {
+                'type': 'object',
+                'default': {'MOZ_LOG': ''},
+                'title': 'Extra environment variables',
+                'description': 'Extra environment variables to use for this run',
+                'additionalProperties': {'type': 'string'}
+            },
+            'preferences': {
+                'type': 'object',
+                'default': {'mygeckopreferences.pref': 'myvalue2'},
+                'title': 'Extra gecko (about:config) preferences',
+                'description': 'Extra gecko (about:config) preferences to use for this run',
+                'additionalProperties': {'type': 'string'}
+            }
+        },
+        'additionalProperties': False,
+        'required': ['path']
+    }
+)
+def mochitest_retrigger_action(parameters, graph_config, input, task_group_id, task_id, task):
+    decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
+        parameters, graph_config)
+
+    pre_task = full_task_graph.tasks[task['metadata']['name']]
+
+    # fix up the task's dependencies, similar to how optimization would
+    # have done in the decision
+    dependencies = {name: label_to_taskid[label]
+                    for name, label in pre_task.dependencies.iteritems()}
+    new_task_definition = resolve_task_references(pre_task.label, pre_task.task, dependencies)
+    new_task_definition.setdefault('dependencies', []).extend(dependencies.itervalues())
+
+    # don't want to run mozharness tests, want a custom mach command instead
+    new_task_definition['payload']['command'] += ['--no-run-tests']
+
+    custom_mach_command = [task['tags']['test-type']]
+
+    # mochitests may specify a flavor
+    if new_task_definition['payload']['env'].get('MOCHITEST_FLAVOR'):
+        custom_mach_command += [
+            '--keep-open=false',
+            '-f',
+            new_task_definition['payload']['env']['MOCHITEST_FLAVOR']
+        ]
+
+    enable_e10s = json.loads(new_task_definition['payload']['env'].get(
+        'ENABLE_E10S', 'true'))
+    if not enable_e10s:
+        custom_mach_command += ['--disable-e10s']
+
+    custom_mach_command += ['--log-tbpl=-',
+                            '--log-tbpl-level={}'.format(input.get('logLevel', 'debug'))]
+    if input.get('runUntilFail'):
+        custom_mach_command += ['--run-until-failure']
+    if input.get('repeat'):
+        custom_mach_command += ['--repeat', str(input.get('repeat', 30))]
+
+    # add any custom gecko preferences
+    for (key, val) in input.get('preferences', {}).iteritems():
+        custom_mach_command += ['--setpref', '{}={}'.format(key, val)]
+
+    custom_mach_command += [input['path']]
+    new_task_definition['payload']['env']['CUSTOM_MACH_COMMAND'] = ' '.join(
+        custom_mach_command)
+
+    # update environment
+    new_task_definition['payload']['env'].update(input.get('environment', {}))
+
+    # tweak the treeherder symbol
+    new_task_definition['extra']['treeherder']['symbol'] += '-custom'
+
+    logging.info("New task definition: %s", new_task_definition)
+
+    # actually create the new task
+    new_task_id = slugid()
+    create_task_from_def(new_task_id, new_task_definition, parameters['level'])