Bug 1397722 - [tryselect] Filter 'ccov' tasks out of the target task set (now they must be selected with --full), r=sparky
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 21 Aug 2018 20:00:32 +0000
changeset 487774 dcedddab6d8947a557b3a9f1724a2a37a4f13b54
parent 487773 8d09209d2ee1a7baa166dedf8425dcbdfd35cfaa
child 487775 7a4039fbcaa5faf0f3c3f75bd3395045c22388a3
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky
bugs1397722
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397722 - [tryselect] Filter 'ccov' tasks out of the target task set (now they must be selected with --full), r=sparky Usually people don't mean to schedule code coverage tasks on try. But e.g |mach try fuzzy -q "'mochitest"|, will cause them to be scheduled as a side effect. This results in wasted resources and superfluous data in ActiveData. This patch makes it so you need to explicitly pass --full to select ccov tasks (even though they're technically part of the target task graph). Differential Revision: https://phabricator.services.mozilla.com/D3917
tools/tryselect/tasks.py
--- a/tools/tryselect/tasks.py
+++ b/tools/tryselect/tasks.py
@@ -1,16 +1,17 @@
 # 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 hashlib
 import os
+import re
 import shutil
 import sys
 
 from mozboot.util import get_state_dir
 from mozbuild.base import MozbuildObject
 from mozpack.files import FileFinder
 
 import taskgraph
@@ -30,29 +31,39 @@ in your working copy:
 
     {}
 
 To fix this, either rebase onto the latest mozilla-central or pass in
 -p/--parameters. For more information on how to define parameters, see:
 https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/mach.html#parameters
 """
 
+# Some tasks show up in the target task set, but are either special cases
+# or uncommon enough that they should only be selectable with --full.
+TARGET_TASK_FILTERS = (
+    '.*-ccov\/.*',
+)
+
 
 def invalidate(cache, root):
     if not os.path.isfile(cache):
         return
 
     tc_dir = os.path.join(root, 'taskcluster')
     tmod = max(os.path.getmtime(os.path.join(tc_dir, p)) for p, _ in FileFinder(tc_dir))
     cmod = os.path.getmtime(cache)
 
     if tmod > cmod:
         os.remove(cache)
 
 
+def filter_target_task(task):
+    return not any(re.search(pattern, task) for pattern in TARGET_TASK_FILTERS)
+
+
 def generate_tasks(params, full, root):
     params = params or "project=mozilla-central"
 
     # Try to delete the old taskgraph cache directory.
     old_cache_dir = os.path.join(get_state_dir()[0], 'cache', 'taskgraph')
     if os.path.isdir(old_cache_dir):
         shutil.rmtree(old_cache_dir)
 
@@ -80,13 +91,16 @@ def generate_tasks(params, full, root):
     taskgraph.fast = True
     cwd = os.getcwd()
     os.chdir(build.topsrcdir)
 
     root = os.path.join(root, 'taskcluster', 'ci')
     tg = getattr(TaskGraphGenerator(root_dir=root, parameters=params), attr)
     labels = [label for label in tg.graph.visit_postorder()]
 
+    if not full:
+        labels = filter(filter_target_task, labels)
+
     os.chdir(cwd)
 
     with open(cache, 'w') as fh:
         fh.write('\n'.join(labels))
     return labels