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

Unified Diff: tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py

Issue 961193002: Make perf try jobs for win x64 build x64 binaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py
diff --git a/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py b/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py
index ea7143ca5b0ca9b10a14349d407aea227612221c..39541ac94a37b0392af3ec6aea1665dcaae84229 100644
--- a/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py
+++ b/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py
@@ -55,31 +55,74 @@ class PossibleTrybotBrowser(possible_browser.PossibleBrowser):
returncode = proc.poll()
return (returncode, out, err)
- def _AttemptTryjob(self, cfg_file_path):
- """Attempts to run a tryjob from the current directory.
-
- This is run once for chromium, and if it returns NO_CHANGES, once for blink.
+ def _UploadPatchAndTry(self):
+ """Uploads patch to reitveld and runs try job."""
+ returncode, output, err = self._RunProcess(
+ ['git', 'commit', '-a', '-m', 'bisect config'])
+ if returncode:
+ return (ERROR, 'Could not commit bisect config change, error %s' % err)
- Args:
- cfg_file_path: Path to the config file for the try job.
+ # Upload the CL to rietveld and run a try job.
+ returncode, output, err = self._RunProcess([
+ 'git', 'cl', 'upload', '-f', '--bypass-hooks', '-m',
+ 'CL for perf tryjob' ])
+ if returncode:
+ return (ERROR, 'Could upload to rietveld, error %s' % err)
- Returns:
- (result, msg) where result is one of:
- SUCCESS if a tryjob was sent
- NO_CHANGES if there was nothing to try,
- ERROR if a tryjob was attempted but an error encountered
- and msg is an error message if an error was encountered, or rietveld
- url if success.
- """
- returncode, original_branchname, err = self._RunProcess(
- ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ match = re.search(r'https://codereview.chromium.org/[\d]+', output)
+ if not match:
+ return (ERROR, 'Could not upload CL to rietveld! Output %s' % output)
+ rietveld_url = match.group(0)
+ returncode, output, err = self._RunProcess([
+ 'git', 'cl', 'try', '-m', 'tryserver.chromium.perf', '-b',
+ self._buildername])
if returncode:
- msg = 'Must be in a git repository to send changes to trybots.'
- if err:
- msg += '\nGit error: %s' % err
- return (ERROR, msg)
- original_branchname = original_branchname.strip()
+ return (ERROR, 'Could not try CL, error %s' % err)
+
+ return (SUCCESS, rietveld_url)
+
+ def _UpdateConfig(self, cfg_file_path):
+ """Modifies perf config file with perf test information."""
+ command = self._GenerateCommand(sys.argv)
+ # Set target architecture to build 32 or 64 bit binaries.
+ target_arch = 'x64' if 'x64' in self._buildername else 'ia32'
+
+ # Add the correct command to the config file and commit it.
+ config = {
+ 'command': command,
+ 'repeat_count': '1',
+ 'max_time_minutes': '120',
+ 'truncate_percent': '0',
+ 'target_arch': target_arch,
+ }
+ try:
+ config_file = open(cfg_file_path, 'w')
+ except IOError:
+ return (ERROR, 'Cannot find %s. Please run from src dir.' % cfg_file_path)
+ config_file.write('config = %s' % json.dumps(
+ config, sort_keys=True, indent=2, separators=(',', ': ')))
+ config_file.close()
+ return (SUCCESS, None)
+
+ def _GenerateCommand(self, arguments):
+ """ Generates the command line for the perf trybots"""
+ if self._target_os == 'win':
+ arguments[0] = 'python tools\\perf\\run_benchmark'
+ else:
+ arguments[0] = './tools/perf/run_benchmark'
+ for index, arg in enumerate(arguments):
+ if arg.startswith('--browser='):
+ if self._target_os == 'android':
+ arguments[index] = '--browser=android-chrome-shell'
+ elif 'x64' in self._buildername:
+ arguments[index] = '--browser=release_x64'
+ else:
+ arguments[index] = '--browser=release'
+ return ' '.join(arguments)
+
+ def _PrepareTryjobBranch(self):
+ """Creates a working branch to trigger perf try job."""
# Check if the tree is dirty: make sure the index is up to date and then
# run diff-index
self._RunProcess(['git', 'update-index', '--refresh', '-q'])
@@ -107,63 +150,50 @@ class PossibleTrybotBrowser(possible_browser.PossibleBrowser):
if returncode:
return (ERROR, 'Error in git branch --set-upstream-to: %s' % err)
- # Generate the command line for the perf trybots
- arguments = sys.argv
- if self._target_os == 'win':
- arguments[0] = 'python tools\\perf\\run_benchmark'
- else:
- arguments[0] = './tools/perf/run_benchmark'
- for index, arg in enumerate(arguments):
- if arg.startswith('--browser='):
- if self._target_os == 'android':
- arguments[index] = '--browser=android-chrome-shell'
- else:
- arguments[index] = '--browser=release'
- command = ' '.join(arguments)
+ return (SUCCESS, None)
- # Add the correct command to the config file and commit it.
- config = {
- 'command': command,
- 'repeat_count': '1',
- 'max_time_minutes': '120',
- 'truncate_percent': '0',
- }
- try:
- config_file = open(cfg_file_path, 'w')
- except IOError:
- msg = 'Cannot find %s. Please run from src dir.' % cfg_file_path
- return (ERROR, msg)
- config_file.write('config = %s' % json.dumps(
- config, sort_keys=True, indent=2, separators=(',', ': ')))
- config_file.close()
- returncode, out, err = self._RunProcess(
- ['git', 'commit', '-a', '-m', 'bisect config'])
- if returncode:
- msg = 'Could not commit bisect config change, error %s' % err
- return (ERROR, msg)
+ def _AttemptTryjob(self, cfg_file_path):
qyearsley 2015/02/27 19:41:09 Besides refactoring _AttemptTryjob and adding targ
prasadv 2015/02/27 23:01:14 Nope!
+ """Attempts to run a tryjob from the current directory.
- # Upload the CL to rietveld and run a try job.
- returncode, out, err = self._RunProcess([
- 'git', 'cl', 'upload', '-f', '--bypass-hooks', '-m',
- 'CL for perf tryjob'
- ])
- if returncode:
- msg = 'Could upload to rietveld, error %s' % err
- return (ERROR, msg)
- match = re.search(r'https://codereview.chromium.org/[\d]+', out)
- if not match:
- msg = 'Could not upload CL to rietveld! Output %s' % out
- return (ERROR, msg)
- rietveld_url = match.group(0)
- returncode, out, err = self._RunProcess([
- 'git', 'cl', 'try', '-m', 'tryserver.chromium.perf', '-b',
- self._buildername])
+ This is run once for chromium, and if it returns NO_CHANGES, once for blink.
+
+ Args:
+ cfg_file_path: Path to the config file for the try job.
+
+ Returns:
+ (result, msg) where result is one of:
+ SUCCESS if a tryjob was sent
+ NO_CHANGES if there was nothing to try,
+ ERROR if a tryjob was attempted but an error encountered
+ and msg is an error message if an error was encountered, or rietveld
+ url if success.
+ """
+ returncode, original_branchname, err = self._RunProcess(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
if returncode:
- msg = 'Could not try CL, error %s' % err
+ msg = 'Must be in a git repository to send changes to trybots.'
+ if err:
+ msg += '\nGit error: %s' % err
return (ERROR, msg)
+ original_branchname = original_branchname.strip()
+
+ # Create temporary branch for running perf tryjob.
+ ret_value, message = self._PrepareTryjobBranch()
+ if ret_value != SUCCESS:
+ return (ret_value, message)
+
+ # Modify perf config with test command, repeat count, max time etc.
+ ret_value, message = self._UpdateConfig(cfg_file_path)
+ if ret_value != SUCCESS:
+ return (ret_value, message)
+
+ # Commit changes, upload patch to reitveld and run try job.
+ ret_value, output = self._UploadPatchAndTry()
+ if ret_value != SUCCESS:
+ return (ret_value, output)
# Checkout original branch and delete telemetry-tryjob branch.
- returncode, out, err = self._RunProcess(
+ returncode, _, err = self._RunProcess(
['git', 'checkout', original_branchname])
if returncode:
msg = (
@@ -171,13 +201,14 @@ class PossibleTrybotBrowser(possible_browser.PossibleBrowser):
'delete the telemetry-tryjob branch. Error message: %s') %
(original_branchname, err))
return (ERROR, msg)
- returncode, out, err = self._RunProcess(
+ returncode, _, err = self._RunProcess(
['git', 'branch', '-D', 'telemetry-tryjob'])
if returncode:
msg = (('Could not delete telemetry-tryjob branch. '
'Please delete it manually. Error %s') % err)
return (ERROR, msg)
- return (SUCCESS, rietveld_url)
+ # Return rietveld url to the uploaded patch on success.
+ return (SUCCESS, output)
def RunRemote(self):
"""Sends a tryjob to a perf trybot.

Powered by Google App Engine
This is Rietveld 408576698