| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import base64 | 6 import base64 |
| 7 import gzip | 7 import gzip |
| 8 import io | 8 import io |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 'src': 'src/third_party/angle', | 83 'src': 'src/third_party/angle', |
| 84 'url': 'https://chromium.googlesource.com/angle/angle.git', | 84 'url': 'https://chromium.googlesource.com/angle/angle.git', |
| 85 }, | 85 }, |
| 86 'catapult': { | 86 'catapult': { |
| 87 'src': 'src/third_party/catapult', | 87 'src': 'src/third_party/catapult', |
| 88 'url': ('https://chromium.googlesource.com/external/github.com/' | 88 'url': ('https://chromium.googlesource.com/external/github.com/' |
| 89 'catapult-project/catapult.git') | 89 'catapult-project/catapult.git') |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 |
| 93 _MILO_MASTER_ENDPOINT = ('https://luci-milo.appspot.com/prpc/milo.Buildbot/' | 94 _MILO_MASTER_ENDPOINT = ('https://luci-milo.appspot.com/prpc/milo.Buildbot/' |
| 94 'GetCompressedMasterJSON') | 95 'GetCompressedMasterJSON') |
| 95 | 96 |
| 96 _MILO_RESPONSE_PREFIX = ')]}\'\n' | 97 _MILO_RESPONSE_PREFIX = ')]}\'\n' |
| 97 | 98 |
| 98 | 99 |
| 99 assert not set(DEFAULT_TRYBOTS) & set(EXCLUDED_BOTS), ( | 100 assert not set(DEFAULT_TRYBOTS) & set(EXCLUDED_BOTS), ( |
| 100 'A trybot cannot present in both Default as well as Excluded bots lists.') | 101 'A trybot cannot present in both Default as well as Excluded bots lists.') |
| 101 | 102 |
| 102 | 103 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 --repo_path=$HOME/mydir/v8/v8 or --repo_path=v8/v8"""), | 378 --repo_path=$HOME/mydir/v8/v8 or --repo_path=v8/v8"""), |
| 378 metavar='<repo path>') | 379 metavar='<repo path>') |
| 379 parser.add_argument( | 380 parser.add_argument( |
| 380 '--deps_revision', type=str, default=None, | 381 '--deps_revision', type=str, default=None, |
| 381 help=('specify DEPS revision to modify DEPS entry in Chromium to a ' | 382 help=('specify DEPS revision to modify DEPS entry in Chromium to a ' |
| 382 'certain pushed revision.\n' | 383 'certain pushed revision.\n' |
| 383 'This revision overrides value in DEPS on TOT Chromium for the ' | 384 'This revision overrides value in DEPS on TOT Chromium for the ' |
| 384 'repo specified in --repo_path.\nIt is applied for both with and ' | 385 'repo specified in --repo_path.\nIt is applied for both with and ' |
| 385 'wihout patch.'), | 386 'wihout patch.'), |
| 386 metavar='<deps revision>') | 387 metavar='<deps revision>') |
| 388 parser.add_argument( |
| 389 '--tot_revision', type=str, default=None) |
| 387 | 390 |
| 388 def Run(self, options, extra_args=None): | 391 def Run(self, options, extra_args=None): |
| 389 """Sends a tryjob to a perf trybot. | 392 """Sends a tryjob to a perf trybot. |
| 390 | 393 |
| 391 This creates a branch, telemetry-tryjob, switches to that branch, edits | 394 This creates a branch, telemetry-tryjob, switches to that branch, edits |
| 392 the bisect config, commits it, uploads the CL to rietveld, and runs a | 395 the bisect config, commits it, uploads the CL to rietveld, and runs a |
| 393 tryjob on the given bot. | 396 tryjob on the given bot. |
| 394 """ | 397 """ |
| 395 if extra_args is None: | 398 if extra_args is None: |
| 396 extra_args = [] | 399 extra_args = [] |
| 397 self._InitializeBuilderNames(options.trybot) | 400 self._InitializeBuilderNames(options.trybot) |
| 398 | 401 |
| 399 return self._AttemptTryjob(options, extra_args) | 402 return self._AttemptTryjob(options, extra_args) |
| 400 | 403 |
| 401 def _GetPerfConfig(self, bot_platform, arguments): | 404 def _GetPerfConfig(self, bot_platform, arguments, tot_revision): |
| 402 """Generates the perf config for try job. | 405 """Generates the perf config for try job. |
| 403 | 406 |
| 404 Args: | 407 Args: |
| 405 bot_platform: Name of the platform to be generated. | 408 bot_platform: Name of the platform to be generated. |
| 406 arguments: Command line arguments. | 409 arguments: Command line arguments. |
| 407 | 410 |
| 408 Returns: | 411 Returns: |
| 409 A dictionary with perf config parameters. | 412 A dictionary with perf config parameters. |
| 410 """ | 413 """ |
| 411 # To make sure that we don't mutate the original args | 414 # To make sure that we don't mutate the original args |
| (...skipping 23 matching lines...) Expand all Loading... |
| 435 arguments.insert(1, '--browser=release') | 438 arguments.insert(1, '--browser=release') |
| 436 | 439 |
| 437 command = ' '.join(arguments) | 440 command = ' '.join(arguments) |
| 438 | 441 |
| 439 return { | 442 return { |
| 440 'command': command, | 443 'command': command, |
| 441 'repeat_count': '1', | 444 'repeat_count': '1', |
| 442 'max_time_minutes': '120', | 445 'max_time_minutes': '120', |
| 443 'truncate_percent': '0', | 446 'truncate_percent': '0', |
| 444 'target_arch': target_arch, | 447 'target_arch': target_arch, |
| 448 'good_revision': tot_revision, |
| 449 'bad_revision': tot_revision, |
| 445 } | 450 } |
| 446 | 451 |
| 447 def _GetRepoAndBranchName(self, repo_path): | 452 def _GetRepoAndBranchName(self, repo_path): |
| 448 """Gets the repository name and working branch name. | 453 """Gets the repository name and working branch name. |
| 449 | 454 |
| 450 Args: | 455 Args: |
| 451 repo_path: Path to the repository. | 456 repo_path: Path to the repository. |
| 452 | 457 |
| 453 Returns: | 458 Returns: |
| 454 Repository name and branch name as tuple. | 459 Repository name and branch name as tuple. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 print ('\nRunning try job....\nview progress here %s.' | 598 print ('\nRunning try job....\nview progress here %s.' |
| 594 '\n\tRepo Name: %s\n\tPath: %s\n\tBranch: %s' % ( | 599 '\n\tRepo Name: %s\n\tPath: %s\n\tBranch: %s' % ( |
| 595 rietveld_url, repo_name, repo_path, branch_name)) | 600 rietveld_url, repo_name, repo_path, branch_name)) |
| 596 | 601 |
| 597 for bot_platform in self._builder_names: | 602 for bot_platform in self._builder_names: |
| 598 if not self._builder_names[bot_platform]: | 603 if not self._builder_names[bot_platform]: |
| 599 logging.warning('No builder is found for %s', bot_platform) | 604 logging.warning('No builder is found for %s', bot_platform) |
| 600 continue | 605 continue |
| 601 try: | 606 try: |
| 602 arguments = [options.benchmark_name] + extra_args | 607 arguments = [options.benchmark_name] + extra_args |
| 603 self._RunTryJob(bot_platform, arguments, deps_override) | 608 self._RunTryJob( |
| 609 bot_platform, arguments, deps_override, options.tot_revision) |
| 604 # Even if git cl try throws TrybotError exception for any platform, | 610 # Even if git cl try throws TrybotError exception for any platform, |
| 605 # keep sending try jobs to other platforms. | 611 # keep sending try jobs to other platforms. |
| 606 except TrybotError, err: | 612 except TrybotError, err: |
| 607 print err | 613 print err |
| 608 except TrybotError, error: | 614 except TrybotError, error: |
| 609 print error | 615 print error |
| 610 return 1 | 616 return 1 |
| 611 finally: | 617 finally: |
| 612 # Restore to original working directory. | 618 # Restore to original working directory. |
| 613 os.chdir(original_workdir) | 619 os.chdir(original_workdir) |
| 614 return 0 | 620 return 0 |
| 615 | 621 |
| 616 def _RunTryJob(self, bot_platform, arguments, deps_override): | 622 def _RunTryJob(self, bot_platform, arguments, deps_override, tot_revision): |
| 617 """Executes perf try job with benchmark test properties. | 623 """Executes perf try job with benchmark test properties. |
| 618 | 624 |
| 619 Args: | 625 Args: |
| 620 bot_platform: Name of the platform to be generated. | 626 bot_platform: Name of the platform to be generated. |
| 621 arguments: Command line arguments. | 627 arguments: Command line arguments. |
| 622 deps_override: DEPS revision if needs to be overridden. | 628 deps_override: DEPS revision if needs to be overridden. |
| 623 | 629 |
| 624 Raises: | 630 Raises: |
| 625 TrybotError: When trybot fails to upload CL or run git try. | 631 TrybotError: When trybot fails to upload CL or run git try. |
| 626 """ | 632 """ |
| 627 config = self._GetPerfConfig(bot_platform, arguments) | 633 config = self._GetPerfConfig(bot_platform, arguments, tot_revision) |
| 628 | 634 |
| 629 # Generate git try command for available bots. | 635 # Generate git try command for available bots. |
| 630 git_try_command = ['cl', 'try', '-m', 'tryserver.chromium.perf'] | 636 git_try_command = ['cl', 'try', '-m', 'tryserver.chromium.perf'] |
| 631 | 637 |
| 632 # Add Perf Test config to git try --properties arg. | 638 # Add Perf Test config to git try --properties arg. |
| 633 git_try_command.extend(['-p', 'perf_try_config=%s' % json.dumps(config)]) | 639 git_try_command.extend(['-p', 'perf_try_config=%s' % json.dumps(config)]) |
| 640 git_try_command.extend(['-p', 'parent_got_revision=%s' % tot_revision]) |
| 634 | 641 |
| 635 error_msg_on_fail = 'Could not try CL for %s' % bot_platform | 642 error_msg_on_fail = 'Could not try CL for %s' % bot_platform |
| 636 # Add deps overrides to git try --properties arg. | 643 # Add deps overrides to git try --properties arg. |
| 637 if deps_override: | 644 if deps_override: |
| 638 git_try_command.extend([ | 645 git_try_command.extend([ |
| 639 '-p', 'deps_revision_overrides=%s' % json.dumps(deps_override)]) | 646 '-p', 'deps_revision_overrides=%s' % json.dumps(deps_override)]) |
| 640 error_msg_on_fail += ' with DEPS override (%s)' % deps_override | 647 error_msg_on_fail += ' with DEPS override (%s)' % deps_override |
| 641 for bot in self._builder_names[bot_platform]: | 648 for bot in self._builder_names[bot_platform]: |
| 642 git_try_command.extend(['-b', bot]) | 649 git_try_command.extend(['-b', bot]) |
| 643 | 650 |
| 644 RunGit(git_try_command, error_msg_on_fail) | 651 RunGit(git_try_command, error_msg_on_fail) |
| 645 print 'Perf Try job sent to rietveld for %s platform.' % bot_platform | 652 print 'Perf Try job sent to rietveld for %s platform.' % bot_platform |
| OLD | NEW |