Bug 1277666 - Use epoch time for rank; r=dustin

Buildbot builds use the epoch time for rank, so Taskcluster needs to use
this as well. Using the pushlog_id instead means that a Buildbot build
will always persist in the "latest" index since the highest value wins.


MozReview-Commit-ID: 1nS6lQv1GoW
This commit is contained in:
Mike Shal 2016-06-15 11:53:38 -04:00
parent 80a6524060
commit 1c6f1572bc
5 changed files with 9 additions and 6 deletions

View File

@ -36,7 +36,7 @@ task:
build_name: '{{build_name}}'
build_type: '{{build_type}}'
index:
rank: {{pushlog_id}}
rank: {{push_epoch}}
treeherder:
jobKind: build
groupSymbol: tc

View File

@ -65,7 +65,7 @@ task:
build: null
tests: null
index:
rank: {{pushlog_id}}
rank: {{push_epoch}}
treeherder:
jobKind: test
groupSymbol: tc

View File

@ -37,6 +37,6 @@ task:
build_name: {{build_name}}
build_type: {{build_type}}
index:
rank: {{pushlog_id}}
rank: {{push_epoch}}
treeherder:
jobKind: test

View File

@ -61,7 +61,7 @@ task:
build_name: '{{build_name}}'
build_type: '{{build_type}}'
index:
rank: {{pushlog_id}}
rank: {{push_epoch}}
treeherder:
jobKind: build
groupSymbol: tc

View File

@ -312,11 +312,11 @@ class LegacyKind(base.Kind):
cmdline_interactive = params.get('interactive', False)
# Default to current time if querying the head rev fails
pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime())
push_epoch = int(time.time())
vcs_info = query_vcs_info(params['head_repository'], params['head_rev'])
changed_files = set()
if vcs_info:
pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(vcs_info.pushdate))
push_epoch = vcs_info.pushdate
logger.debug('{} commits influencing task scheduling:'.format(len(vcs_info.changesets)))
for c in vcs_info.changesets:
@ -325,6 +325,8 @@ class LegacyKind(base.Kind):
desc=c['desc'].splitlines()[0].encode('ascii', 'ignore')))
changed_files |= set(c['files'])
pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(push_epoch))
# Template parameters used when expanding the graph
parameters = dict(gaia_info().items() + {
'index': 'index',
@ -337,6 +339,7 @@ class LegacyKind(base.Kind):
'head_ref': params['head_ref'] or params['head_rev'],
'head_rev': params['head_rev'],
'pushdate': pushdate,
'push_epoch': push_epoch,
'pushtime': pushdate[8:],
'year': pushdate[0:4],
'month': pushdate[4:6],