Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tools/bisect-perf-regression.py

Issue 508723004: Use Git hash to post try job http request to bisect builders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Performance Test Bisect Tool 6 """Performance Test Bisect Tool
7 7
8 This script bisects a series of changelists using binary search. It starts at 8 This script bisects a series of changelists using binary search. It starts at
9 a bad revision where a performance metric has regressed, and asks for a last 9 a bad revision where a performance metric has regressed, and asks for a last
10 known-good revision. It will then binary search across this revision range by 10 known-good revision. It will then binary search across this revision range by
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 self.BackupOrRestoreOutputdirectory(restore=True) 1300 self.BackupOrRestoreOutputdirectory(restore=True)
1301 # Cleanup any leftovers from unzipping. 1301 # Cleanup any leftovers from unzipping.
1302 if os.path.exists(output_dir): 1302 if os.path.exists(output_dir):
1303 RmTreeAndMkDir(output_dir, skip_makedir=True) 1303 RmTreeAndMkDir(output_dir, skip_makedir=True)
1304 finally: 1304 finally:
1305 # Delete downloaded archive 1305 # Delete downloaded archive
1306 if os.path.exists(downloaded_file): 1306 if os.path.exists(downloaded_file):
1307 os.remove(downloaded_file) 1307 os.remove(downloaded_file)
1308 return False 1308 return False
1309 1309
1310 def PostBuildRequestAndWait(self, revision, fetch_build, patch=None): 1310 def PostBuildRequestAndWait(self, git_revision, fetch_build, patch=None):
1311 """POSTs the build request job to the try server instance. 1311 """POSTs the build request job to the try server instance.
1312 1312
1313 A try job build request is posted to tryserver.chromium.perf master, 1313 A try job build request is posted to tryserver.chromium.perf master,
1314 and waits for the binaries to be produced and archived on cloud storage. 1314 and waits for the binaries to be produced and archived on cloud storage.
1315 Once the build is ready and stored onto cloud, build archive is downloaded 1315 Once the build is ready and stored onto cloud, build archive is downloaded
1316 into the output folder. 1316 into the output folder.
1317 1317
1318 Args: 1318 Args:
1319 revision: A Git hash revision. 1319 git_revision: A Git hash revision.
1320 fetch_build: Function to check and download build from cloud storage. 1320 fetch_build: Function to check and download build from cloud storage.
1321 patch: A DEPS patch (used while bisecting 3rd party repositories). 1321 patch: A DEPS patch (used while bisecting 3rd party repositories).
1322 1322
1323 Returns: 1323 Returns:
1324 Downloaded archive file path when requested build exists and download is 1324 Downloaded archive file path when requested build exists and download is
1325 successful, otherwise None. 1325 successful, otherwise None.
1326 """ 1326 """
1327 # Get SVN revision for the given SHA.
1328 svn_revision = self.source_control.SVNFindRev(revision)
1329 if not svn_revision:
1330 raise RuntimeError(
1331 'Failed to determine SVN revision for %s' % revision)
1332
1333 def GetBuilderNameAndBuildTime(target_platform, target_arch='ia32'): 1327 def GetBuilderNameAndBuildTime(target_platform, target_arch='ia32'):
1334 """Gets builder bot name and build time in seconds based on platform.""" 1328 """Gets builder bot name and build time in seconds based on platform."""
1335 # Bot names should match the one listed in tryserver.chromium's 1329 # Bot names should match the one listed in tryserver.chromium's
1336 # master.cfg which produces builds for bisect. 1330 # master.cfg which produces builds for bisect.
1337 if bisect_utils.IsWindowsHost(): 1331 if bisect_utils.IsWindowsHost():
1338 if bisect_utils.Is64BitWindows() and target_arch == 'x64': 1332 if bisect_utils.Is64BitWindows() and target_arch == 'x64':
1339 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) 1333 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME)
1340 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) 1334 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME)
1341 if bisect_utils.IsLinuxHost(): 1335 if bisect_utils.IsLinuxHost():
1342 if target_platform == 'android': 1336 if target_platform == 'android':
1343 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) 1337 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME)
1344 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) 1338 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME)
1345 if bisect_utils.IsMacHost(): 1339 if bisect_utils.IsMacHost():
1346 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) 1340 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME)
1347 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) 1341 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform)
1348 if not fetch_build: 1342 if not fetch_build:
1349 return False 1343 return False
1350 1344
1351 bot_name, build_timeout = GetBuilderNameAndBuildTime( 1345 bot_name, build_timeout = GetBuilderNameAndBuildTime(
1352 self.opts.target_platform, self.opts.target_arch) 1346 self.opts.target_platform, self.opts.target_arch)
1353 builder_host = self.opts.builder_host 1347 builder_host = self.opts.builder_host
1354 builder_port = self.opts.builder_port 1348 builder_port = self.opts.builder_port
1355 # Create a unique ID for each build request posted to try server builders. 1349 # Create a unique ID for each build request posted to try server builders.
1356 # This ID is added to "Reason" property of the build. 1350 # This ID is added to "Reason" property of the build.
1357 build_request_id = GetSHA1HexDigest( 1351 build_request_id = GetSHA1HexDigest(
1358 '%s-%s-%s' % (svn_revision, patch, time.time())) 1352 '%s-%s-%s' % (git_revision, patch, time.time()))
1359 1353
1360 # Creates a try job description. 1354 # Creates a try job description.
1355 # Always use Git hash to post build request since Commit positions are
1356 # not supported by builders to build.
1361 job_args = { 1357 job_args = {
1362 'revision': 'src@%s' % svn_revision, 1358 'revision': 'src@%s' % git_revision,
1363 'bot': bot_name, 1359 'bot': bot_name,
1364 'name': build_request_id, 1360 'name': build_request_id,
1365 } 1361 }
1366 # Update patch information if supplied. 1362 # Update patch information if supplied.
1367 if patch: 1363 if patch:
1368 job_args['patch'] = patch 1364 job_args['patch'] = patch
1369 # Posts job to build the revision on the server. 1365 # Posts job to build the revision on the server.
1370 if bisect_builder.PostTryJob(builder_host, builder_port, job_args): 1366 if bisect_builder.PostTryJob(builder_host, builder_port, job_args):
1371 target_file, error_msg = _WaitUntilBuildIsReady( 1367 target_file, error_msg = _WaitUntilBuildIsReady(
1372 fetch_build, bot_name, builder_host, builder_port, build_request_id, 1368 fetch_build, bot_name, builder_host, builder_port, build_request_id,
1373 build_timeout) 1369 build_timeout)
1374 if not target_file: 1370 if not target_file:
1375 print '%s [revision: %s]' % (error_msg, svn_revision) 1371 print '%s [revision: %s]' % (error_msg, git_revision)
1376 return None 1372 return None
1377 return target_file 1373 return target_file
1378 print 'Failed to post build request for revision: [%s]' % svn_revision 1374 print 'Failed to post build request for revision: [%s]' % git_revision
1379 return None 1375 return None
1380 1376
1381 def IsDownloadable(self, depot): 1377 def IsDownloadable(self, depot):
1382 """Checks if build can be downloaded based on target platform and depot.""" 1378 """Checks if build can be downloaded based on target platform and depot."""
1383 if (self.opts.target_platform in ['chromium', 'android'] and 1379 if (self.opts.target_platform in ['chromium', 'android'] and
1384 self.opts.gs_bucket): 1380 self.opts.gs_bucket):
1385 return (depot == 'chromium' or 1381 return (depot == 'chromium' or
1386 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or 1382 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or
1387 'v8' in DEPOT_DEPS_NAME[depot]['from']) 1383 'v8' in DEPOT_DEPS_NAME[depot]['from'])
1388 return False 1384 return False
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
3362 # bugs. If you change this, please update the perf dashboard as well. 3358 # bugs. If you change this, please update the perf dashboard as well.
3363 bisect_utils.OutputAnnotationStepStart('Results') 3359 bisect_utils.OutputAnnotationStepStart('Results')
3364 print 'Error: %s' % e.message 3360 print 'Error: %s' % e.message
3365 if opts.output_buildbot_annotations: 3361 if opts.output_buildbot_annotations:
3366 bisect_utils.OutputAnnotationStepClosed() 3362 bisect_utils.OutputAnnotationStepClosed()
3367 return 1 3363 return 1
3368 3364
3369 3365
3370 if __name__ == '__main__': 3366 if __name__ == '__main__':
3371 sys.exit(main()) 3367 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698