Bug 1329783 - Have gecko decision task determine when to call seta; r=jmaher
authorRob Wood <rwood@mozilla.com>
Thu, 19 Jan 2017 16:00:33 -0500
changeset 375304 e8c9758e6322ef6de8a7c03deefcc49417382f96
parent 375303 ec7143bb25f0a4fab2b783a833da6b763ffb3e10
child 375305 056197b55d495037138db1507583816efd574d87
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1329783
milestone53.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 1329783 - Have gecko decision task determine when to call seta; r=jmaher MozReview-Commit-ID: H3hnDqS6Vgy
taskcluster/taskgraph/task/transform.py
taskcluster/taskgraph/util/seta.py
--- a/taskcluster/taskgraph/task/transform.py
+++ b/taskcluster/taskgraph/task/transform.py
@@ -91,17 +91,17 @@ class TransformTask(base.Task):
                 params, self.when['files-changed'])
             if not changed:
                 logger.debug('no files found matching a pattern in `when.files-changed` for ' +
                              self.label)
                 return True, None
 
         # we would like to return 'False, None' while it's high_value_task
         # and we wouldn't optimize it. Otherwise, it will return 'True, None'
-        if is_low_value_task(self.label, params.get('project')):
+        if is_low_value_task(self.label, params.get('project'), params.get('pushlog_id')):
             # Always optimize away low-value tasks
             return True, None
         else:
             return False, None
 
     @classmethod
     def from_json(cls, task_dict):
         # when reading back from JSON, we lose the "when" information
--- a/taskcluster/taskgraph/util/seta.py
+++ b/taskcluster/taskgraph/util/seta.py
@@ -6,16 +6,18 @@ from requests import exceptions
 
 logger = logging.getLogger(__name__)
 headers = {
     'User-Agent': 'TaskCluster'
 }
 
 # It's a list of project name which SETA is useful on
 SETA_PROJECTS = ['mozilla-inbound', 'autoland']
+PROJECT_SCHEDULE_ALL_EVERY = {'mozilla-inbound': 5, 'autoland': 5}
+
 SETA_ENDPOINT = "https://seta.herokuapp.com/data/setadetails/?branch=%s"
 
 
 class SETA(object):
     """
     Interface to the SETA service, which defines low-value tasks that can be optimized out
     of the taskgraph.
     """
@@ -69,17 +71,21 @@ class SETA(object):
             logger.warning(error)
 
         # When we get invalid JSON (i.e. 500 error), it results in a ValueError (bug 1313426)
         except ValueError as error:
             logger.warning("Invalid JSON, possible server error: {}".format(error))
 
         return low_value_tasks
 
-    def is_low_value_task(self, label, project):
+    def is_low_value_task(self, label, project, pushlog_id):
+        schedule_all_every = PROJECT_SCHEDULE_ALL_EVERY.get(project, 5)
+        # on every Nth push, want to run all tasks
+        if int(pushlog_id) % schedule_all_every == 0:
+            return False
         # cache the low value tasks per project to avoid repeated SETA server queries
         if project not in self.low_value_tasks:
             self.low_value_tasks[project] = self.query_low_value_tasks(project)
         return label in self.low_value_tasks[project]
 
 # create a single instance of this class, and expose its `is_low_value_task`
 # bound method as a module-level function
 is_low_value_task = SETA().is_low_value_task