Bug 1329783 - Have gecko decision task determine when to call seta; r=jmaher
MozReview-Commit-ID: H3hnDqS6Vgy
--- 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