OLD | NEW |
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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 res = fetch_build() | 532 res = fetch_build() |
533 if res: | 533 if res: |
534 return (res, 'Build successfully found') | 534 return (res, 'Build successfully found') |
535 elapsed_status_check = time.time() - last_status_check | 535 elapsed_status_check = time.time() - last_status_check |
536 # To avoid overloading try server with status check requests, we check | 536 # To avoid overloading try server with status check requests, we check |
537 # build status for every 10 minutes. | 537 # build status for every 10 minutes. |
538 if elapsed_status_check > status_check_interval: | 538 if elapsed_status_check > status_check_interval: |
539 last_status_check = time.time() | 539 last_status_check = time.time() |
540 if not build_num: | 540 if not build_num: |
541 # Get the build number on try server for the current build. | 541 # Get the build number on try server for the current build. |
542 build_num = bisect_builder.GetBuildNumFromBuilder( | 542 build_num = request_build.GetBuildNumFromBuilder( |
543 build_request_id, bot_name, builder_host, builder_port) | 543 build_request_id, bot_name, builder_host, builder_port) |
544 # Check the status of build using the build number. | 544 # Check the status of build using the build number. |
545 # Note: Build is treated as PENDING if build number is not found | 545 # Note: Build is treated as PENDING if build number is not found |
546 # on the the try server. | 546 # on the the try server. |
547 build_status, status_link = bisect_builder.GetBuildStatus( | 547 build_status, status_link = request_build.GetBuildStatus( |
548 build_num, bot_name, builder_host, builder_port) | 548 build_num, bot_name, builder_host, builder_port) |
549 if build_status == bisect_builder.FAILED: | 549 if build_status == request_build.FAILED: |
550 return (None, 'Failed to produce build, log: %s' % status_link) | 550 return (None, 'Failed to produce build, log: %s' % status_link) |
551 elapsed_time = time.time() - start_time | 551 elapsed_time = time.time() - start_time |
552 if elapsed_time > max_timeout: | 552 if elapsed_time > max_timeout: |
553 return (None, 'Timed out: %ss without build' % max_timeout) | 553 return (None, 'Timed out: %ss without build' % max_timeout) |
554 | 554 |
555 print 'Time elapsed: %ss without build.' % elapsed_time | 555 print 'Time elapsed: %ss without build.' % elapsed_time |
556 time.sleep(poll_interval) | 556 time.sleep(poll_interval) |
557 # For some reason, mac bisect bots were not flushing stdout periodically. | 557 # For some reason, mac bisect bots were not flushing stdout periodically. |
558 # As a result buildbot command is timed-out. Flush stdout on all platforms | 558 # As a result buildbot command is timed-out. Flush stdout on all platforms |
559 # while waiting for build. | 559 # while waiting for build. |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 # not supported by builders to build. | 1362 # not supported by builders to build. |
1363 job_args = { | 1363 job_args = { |
1364 'revision': 'src@%s' % git_revision, | 1364 'revision': 'src@%s' % git_revision, |
1365 'bot': bot_name, | 1365 'bot': bot_name, |
1366 'name': build_request_id, | 1366 'name': build_request_id, |
1367 } | 1367 } |
1368 # Update patch information if supplied. | 1368 # Update patch information if supplied. |
1369 if patch: | 1369 if patch: |
1370 job_args['patch'] = patch | 1370 job_args['patch'] = patch |
1371 # Posts job to build the revision on the server. | 1371 # Posts job to build the revision on the server. |
1372 if bisect_builder.PostTryJob(builder_host, builder_port, job_args): | 1372 if request_build.PostTryJob(builder_host, builder_port, job_args): |
1373 target_file, error_msg = _WaitUntilBuildIsReady( | 1373 target_file, error_msg = _WaitUntilBuildIsReady( |
1374 fetch_build, bot_name, builder_host, builder_port, build_request_id, | 1374 fetch_build, bot_name, builder_host, builder_port, build_request_id, |
1375 build_timeout) | 1375 build_timeout) |
1376 if not target_file: | 1376 if not target_file: |
1377 print '%s [revision: %s]' % (error_msg, git_revision) | 1377 print '%s [revision: %s]' % (error_msg, git_revision) |
1378 return None | 1378 return None |
1379 return target_file | 1379 return target_file |
1380 print 'Failed to post build request for revision: [%s]' % git_revision | 1380 print 'Failed to post build request for revision: [%s]' % git_revision |
1381 return None | 1381 return None |
1382 | 1382 |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3359 # bugs. If you change this, please update the perf dashboard as well. | 3359 # bugs. If you change this, please update the perf dashboard as well. |
3360 bisect_utils.OutputAnnotationStepStart('Results') | 3360 bisect_utils.OutputAnnotationStepStart('Results') |
3361 print 'Error: %s' % e.message | 3361 print 'Error: %s' % e.message |
3362 if opts.output_buildbot_annotations: | 3362 if opts.output_buildbot_annotations: |
3363 bisect_utils.OutputAnnotationStepClosed() | 3363 bisect_utils.OutputAnnotationStepClosed() |
3364 return 1 | 3364 return 1 |
3365 | 3365 |
3366 | 3366 |
3367 if __name__ == '__main__': | 3367 if __name__ == '__main__': |
3368 sys.exit(main()) | 3368 sys.exit(main()) |
OLD | NEW |