Commit 1e3f09b9 authored by qyearsley's avatar qyearsley Committed by Commit bot

Rename and refactor PostBuildRequestAndWait.

BUG=

Review URL: https://codereview.chromium.org/667453004

Cr-Commit-Position: refs/heads/master@{#300603}
parent 33c0ab9d
...@@ -1322,7 +1322,7 @@ class BisectPerformanceMetrics(object): ...@@ -1322,7 +1322,7 @@ class BisectPerformanceMetrics(object):
# When build archive doesn't exists, post a build request to tryserver # When build archive doesn't exists, post a build request to tryserver
# and wait for the build to be produced. # and wait for the build to be produced.
if not downloaded_file: if not downloaded_file:
downloaded_file = self.PostBuildRequestAndWait( downloaded_file = self._RequestBuildAndWait(
revision, fetch_build=fetch_build_func, patch=patch) revision, fetch_build=fetch_build_func, patch=patch)
if not downloaded_file: if not downloaded_file:
return False return False
...@@ -1362,13 +1362,12 @@ class BisectPerformanceMetrics(object): ...@@ -1362,13 +1362,12 @@ class BisectPerformanceMetrics(object):
os.remove(downloaded_file) os.remove(downloaded_file)
return False return False
def PostBuildRequestAndWait(self, git_revision, fetch_build, patch=None): def _RequestBuildAndWait(self, git_revision, fetch_build, patch=None):
"""POSTs the build request job to the try server instance. """Triggers a try job for a build job.
A try job build request is posted to tryserver.chromium.perf master, This function prepares and starts a try job on the tryserver.chromium.perf
and waits for the binaries to be produced and archived on cloud storage. master, and waits for the binaries to be produced and archived in cloud
Once the build is ready and stored onto cloud, build archive is downloaded storage. Once the build is ready it's downloaded.
into the output folder.
Args: Args:
git_revision: A Git hash revision. git_revision: A Git hash revision.
...@@ -1379,21 +1378,6 @@ class BisectPerformanceMetrics(object): ...@@ -1379,21 +1378,6 @@ class BisectPerformanceMetrics(object):
Downloaded archive file path when requested build exists and download is Downloaded archive file path when requested build exists and download is
successful, otherwise None. successful, otherwise None.
""" """
def GetBuilderNameAndBuildTime(target_platform, target_arch='ia32'):
"""Gets builder bot name and build time in seconds based on platform."""
# Bot names should match the one listed in tryserver.chromium's
# master.cfg which produces builds for bisect.
if bisect_utils.IsWindowsHost():
if bisect_utils.Is64BitWindows() and target_arch == 'x64':
return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME)
return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME)
if bisect_utils.IsLinuxHost():
if target_platform == 'android':
return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME)
return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME)
if bisect_utils.IsMacHost():
return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME)
raise NotImplementedError('Unsupported Platform "%s".' % sys.platform)
if not fetch_build: if not fetch_build:
return False return False
...@@ -1406,8 +1390,8 @@ class BisectPerformanceMetrics(object): ...@@ -1406,8 +1390,8 @@ class BisectPerformanceMetrics(object):
source_control.CheckoutFileAtRevision( source_control.CheckoutFileAtRevision(
bisect_utils.FILE_DEPS, git_revision, cwd=self.src_cwd) bisect_utils.FILE_DEPS, git_revision, cwd=self.src_cwd)
bot_name, build_timeout = GetBuilderNameAndBuildTime( bot_name = self._GetBuilderName(self.opts.target_platform)
self.opts.target_platform, self.opts.target_arch) build_timeout = self._GetBuilderBuildTime()
target_file = None target_file = None
try: try:
# Execute try job request to build revision with patch. # Execute try job request to build revision with patch.
...@@ -1423,6 +1407,30 @@ class BisectPerformanceMetrics(object): ...@@ -1423,6 +1407,30 @@ class BisectPerformanceMetrics(object):
return target_file return target_file
@staticmethod
def _GetBuilderName(target_platform):
"""Gets builder bot name and build time in seconds based on platform."""
if bisect_utils.IsWindowsHost():
return 'win_perf_bisect_builder'
if bisect_utils.IsLinuxHost():
if target_platform == 'android':
return 'android_perf_bisect_builder'
return 'linux_perf_bisect_builder'
if bisect_utils.IsMacHost():
return 'mac_perf_bisect_builder'
raise NotImplementedError('Unsupported Platform "%s".' % sys.platform)
@staticmethod
def _GetBuilderBuildTime():
"""Returns the time to wait for a build after requesting one."""
if bisect_utils.IsWindowsHost():
return MAX_WIN_BUILD_TIME
if bisect_utils.IsLinuxHost():
return MAX_LINUX_BUILD_TIME
if bisect_utils.IsMacHost():
return MAX_MAC_BUILD_TIME
raise NotImplementedError('Unsupported Platform "%s".' % sys.platform)
def IsDownloadable(self, depot): def IsDownloadable(self, depot):
"""Checks if build can be downloaded based on target platform and depot.""" """Checks if build can be downloaded based on target platform and depot."""
if (self.opts.target_platform in ['chromium', 'android'] and if (self.opts.target_platform in ['chromium', 'android'] and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment