Bug 1415619: Add some routes that humans can use to cached tasks.
MozReview-Commit-ID: BmiJ8WBl6yq
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -19,17 +19,17 @@ from taskgraph.transforms.job.common imp
docker_worker_add_tooltool,
support_vcs_checkout,
)
from taskgraph.util.hash import hash_paths
from taskgraph import GECKO
from taskgraph.util.cached_tasks import add_optimization
-CACHE_TYPE = 'toolchains.v1'
+CACHE_TYPE = 'toolchains.v2'
toolchain_run_schema = Schema({
Required('using'): 'toolchain-script',
# The script (in taskcluster/scripts/misc) to run.
# Python scripts are invoked with `mach python` so vendored libraries
# are available.
Required('script'): basestring,
--- a/taskcluster/taskgraph/util/cached_tasks.py
+++ b/taskcluster/taskgraph/util/cached_tasks.py
@@ -1,20 +1,25 @@
# 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 time
TARGET_CACHE_INDEX = (
- 'gecko.cache.level-{level}.{type}.{name}.{digest}'
+ 'gecko.cache.level-{level}.{type}.{name}.hash.{digest}'
)
+EXTRA_CACHE_INDEXES = [
+ 'gecko.cache.level-{level}.{type}.{name}.latest',
+ 'gecko.cache.level-{level}.{type}.{name}.pushdate.{build_date_long}',
+]
def add_optimization(config, taskdesc, cache_type, cache_name, digest=None, digest_data=None):
"""
Allow the results of this task to be cached. This adds index routes to the
task so it can be looked up for future runs, and optimization hints so that
cached artifacts can be found. Exactly one of `digest` and `digest_data`
must be passed.
@@ -48,8 +53,16 @@ def add_optimization(config, taskdesc, c
for level in reversed(range(int(config.params['level']), 4)):
subs['level'] = level
index_routes.append(TARGET_CACHE_INDEX.format(**subs))
taskdesc['optimization'] = {'index-search': index_routes}
# ... and cache at the lowest level.
taskdesc.setdefault('routes', []).append(
'index.{}'.format(TARGET_CACHE_INDEX.format(**subs)))
+
+ # ... and add some extra routes for humans
+ subs['build_date_long'] = time.strftime("%Y.%m.%d.%Y%m%d%H%M%S",
+ time.gmtime(config.params['build_date']))
+ taskdesc['routes'].extend([
+ 'index.{}'.format(route.format(**subs))
+ for route in EXTRA_CACHE_INDEXES
+ ])