Bug 1289122 - Remove coalescing from PGO try jobs. r=dustin
MozReview-Commit-ID: KAqZlUjMXdQ
***
Bug 1289122 - bugfix to chain together the elements to be removed. r=dustin
MozReview-Commit-ID: 3XhHZgmq6e3
--- a/taskcluster/taskgraph/task/legacy.py
+++ b/taskcluster/taskgraph/task/legacy.py
@@ -163,16 +163,40 @@ def remove_caches_from_task(task):
try:
scopes.remove(scope)
except ValueError:
raise ValueError("scope '{}' not in {}".format(scope, scopes))
except KeyError:
pass
+def remove_coalescing_from_task(task):
+ r"""Remove coalescing route and supersederUrl from job task
+
+ :param task: task definition.
+ """
+ patterns = [
+ re.compile("^coalesce.v1.builds.*pgo$"),
+ ]
+
+ try:
+ payload = task["task"]["payload"]
+ routes = task["task"]["routes"]
+ removable_routes = [route for route in list(routes)
+ if any([p.match(route) for p in patterns])]
+ if removable_routes:
+ # we remove supersederUrl only when we have also routes to remove
+ payload.pop("supersederUrl")
+
+ for route in removable_routes:
+ routes.remove(route)
+ except KeyError:
+ pass
+
+
def query_vcs_info(repository, revision):
"""Query the pushdate and pushid of a repository/revision.
This is intended to be used on hg.mozilla.org/mozilla-central and
similar. It may or may not work for other hg repositories.
"""
if not repository or not revision:
logger.warning('cannot query vcs info because vcs info not provided')
@@ -468,19 +492,20 @@ class LegacyTask(base.Task):
tier = task_extra['treeherder'].get('tier', 1)
if tier != 1:
# Only tier 1 jobs use the build time as rank. Everything
# else gets rank 0 until it is promoted to tier 1.
task_extra['index']['rank'] = 0
set_interactive_task(build_task, interactive)
- # try builds don't use cache
+ # try builds don't use cache nor coalescing
if project == "try":
remove_caches_from_task(build_task)
+ remove_coalescing_from_task(build_task)
set_expiration(build_task, TRY_EXPIRATION)
decorate_task_treeherder_routes(build_task['task'],
build_parameters['project'],
build_parameters['head_rev'],
build_parameters['pushlog_id'])
decorate_task_json_routes(build_task['task'],
json_routes,