Skip to content

Instantly share code, notes, and snippets.

@rail
Created October 11, 2016 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rail/2b1c0f8d8520e5cb87451f0842c11586 to your computer and use it in GitHub Desktop.
Save rail/2b1c0f8d8520e5cb87451f0842c11586 to your computer and use it in GitHub Desktop.
diff --git a/buildfarm/release/release-runner.py b/buildfarm/release/release-runner.py
--- a/buildfarm/release/release-runner.py
+++ b/buildfarm/release/release-runner.py
@@ -374,17 +374,17 @@ def main(options):
ship_it_product_name = release['product']
tc_product_name = branchConfig['stage_product'][ship_it_product_name]
# XXX: Doesn't work with neither Fennec nor Thunderbird
platforms = branchConfig['release_platforms']
try:
if not are_en_us_builds_completed(index, release_name=release['name'], submitted_at=release['submittedAt'],
branch=release['branchShortName'], revision=release['mozillaRevision'],
- tc_product_name=tc_product_name, platforms=platforms):
+ tc_product_name=tc_product_name, platforms=platforms, queue=queue):
log.info('Builds are not completed yet, skipping release "%s" for now', release['name'])
rr.update_status(release, 'Waiting for builds to be completed')
continue
log.info('Every build is completed for release: %s', release['name'])
graph_id = slugId()
rr.update_status(release, 'Generating task graph')
diff --git a/lib/python/kickoff/build_status.py b/lib/python/kickoff/build_status.py
--- a/lib/python/kickoff/build_status.py
+++ b/lib/python/kickoff/build_status.py
@@ -6,22 +6,26 @@ from kickoff import task_for_revision
import logging
log = logging.getLogger(__name__)
_BUILD_WATCHERS = {}
-# TODO: Bug 1300147. Avoid having 7 parameters by using a release object that contains only what's needed.
-def are_en_us_builds_completed(index, release_name, submitted_at, branch, revision, tc_product_name, platforms):
+# TODO: Bug 1300147. Avoid having many parameters by using a release object
+# that contains only what's needed.
+def are_en_us_builds_completed(index, release_name, submitted_at, branch,
+ revision, tc_product_name, platforms, queue):
try:
watcher = _BUILD_WATCHERS[release_name]
except KeyError:
- watcher = EnUsBuildsWatcher(index, release_name, submitted_at, branch, revision, tc_product_name, platforms)
+ watcher = EnUsBuildsWatcher(
+ index, release_name, submitted_at, branch, revision,
+ tc_product_name, platforms, queue)
_BUILD_WATCHERS[release_name] = watcher
log.debug('New watcher created for "%s"', release_name)
result = watcher.are_builds_completed()
if result is True:
del _BUILD_WATCHERS[release_name]
log.debug('Builds for "%s" are completed. Watcher deleted', release_name)
@@ -32,24 +36,26 @@ def are_en_us_builds_completed(index, re
class LoggedError(Exception):
def __init__(self, message):
log.exception(message)
Exception.__init__(self, message)
class EnUsBuildsWatcher:
# TODO: Bug 1300147 as well
- def __init__(self, index, release_name, submitted_at, branch, revision, tc_product_name, platforms):
+ def __init__(self, index, release_name, submitted_at, branch, revision,
+ tc_product_name, platforms, queue):
self.taskcluster_index = index
self.taskcluster_product_name = tc_product_name
self.release_name = release_name
self.branch = branch
self.revision = revision
self.task_per_platform = {p: None for p in platforms}
+ self.queue = queue
self._timeout_watcher = TimeoutWatcher(start_timestamp=submitted_at)
def are_builds_completed(self):
if self._timeout_watcher.timed_out:
raise TimeoutWatcher.TimeoutError(self.release_name, self._timeout_watcher.start_timestamp)
self._fetch_completed_tasks()
@@ -62,16 +68,23 @@ class EnUsBuildsWatcher:
for platform in platforms_with_no_task:
try:
# Tasks are always completed if they are referenced in the index
# https://docs.taskcluster.net/reference/core/index
task_id = task_for_revision(
self.taskcluster_index, self.branch, self.revision, self.taskcluster_product_name, platform
)['taskId']
+ # make sure to use tasks indexed with rank set > 0
+ task = self.queue.task(task_id)
+ rank = task["extra"]["index"]["rank"]
+ if rank == 0:
+ log.debug("Ignoring task %s because the rank is set to %s",
+ task_id, rank)
+ continue
except TaskclusterRestFailure:
log.debug('Task for platform "%s" is not yet created for release "%s"', platform, self.release_name)
continue
log.debug('Task "%s" was found for release "%s" and platform "%s"', task_id, self.release_name, platform)
self.task_per_platform[platform] = task_id
@property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment