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

Side by Side Diff: tools/perf/core/trybot_command.py

Issue 1780453002: [PerfTry] Make it possible to ./run_benchmark try within tools/perf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « third_party/WebKit/Tools/run-perf-test.cfg ('k') | 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 # 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 os 6 import os
7 import logging 7 import logging
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import urllib2 10 import urllib2
11 import json 11 import json
12 12
13 from telemetry.util import command_line 13 from telemetry.util import command_line
14 14
15 from core import path_util
15 16
16 CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg' 17
17 BLINK_CONFIG_FILENAME = 'Tools/run-perf-test.cfg' 18 CHROMIUM_CONFIG_FILENAME = os.path.join(path_util.GetChromiumSrcDir(), 'tools',
nednguyen 2016/03/08 20:39:52 Can you rename this to CHROMIUM_TRYBOT_CONFIG_PATH
19 'run-perf-test.cfg')
18 SUCCESS, NO_CHANGES, ERROR = range(3) 20 SUCCESS, NO_CHANGES, ERROR = range(3)
19 # Unsupported Perf bisect bots. 21 # Unsupported Perf bisect bots.
20 EXCLUDED_BOTS = { 22 EXCLUDED_BOTS = {
21 'win_xp_perf_bisect', # Goma issues: crbug.com/330900 23 'win_xp_perf_bisect', # Goma issues: crbug.com/330900
22 'win_perf_bisect_builder', 24 'win_perf_bisect_builder',
23 'win64_nv_tester', 25 'win64_nv_tester',
24 'winx64_bisect_builder', 26 'winx64_bisect_builder',
25 'linux_perf_bisect_builder', 27 'linux_perf_bisect_builder',
26 'mac_perf_bisect_builder', 28 'mac_perf_bisect_builder',
27 'android_perf_bisect_builder', 29 'android_perf_bisect_builder',
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 """ 194 """
193 if extra_args is None: 195 if extra_args is None:
194 extra_args = [] 196 extra_args = []
195 self._InitializeBuilderNames(options.trybot) 197 self._InitializeBuilderNames(options.trybot)
196 198
197 arguments = [options.benchmark_name] + extra_args 199 arguments = [options.benchmark_name] + extra_args
198 200
199 # First check if there are chromium changes to upload. 201 # First check if there are chromium changes to upload.
200 status = self._AttemptTryjob(CHROMIUM_CONFIG_FILENAME, arguments) 202 status = self._AttemptTryjob(CHROMIUM_CONFIG_FILENAME, arguments)
201 if status not in [SUCCESS, ERROR]: 203 if status not in [SUCCESS, ERROR]:
202 # If we got here, there are no chromium changes to upload. Try blink.
203 os.chdir('third_party/WebKit/')
204 status = self._AttemptTryjob(BLINK_CONFIG_FILENAME, arguments)
205 os.chdir('../..')
206 if status not in [SUCCESS, ERROR]: 204 if status not in [SUCCESS, ERROR]:
207 logging.error('No local changes found in chromium or blink trees. ' 205 logging.error('No local changes found in chromium or blink trees. '
208 'browser=%s argument sends local changes to the ' 206 'browser=%s argument sends local changes to the '
209 'perf trybot(s): %s.', options.trybot, 207 'perf trybot(s): %s.', options.trybot,
210 self._builder_names.values()) 208 self._builder_names.values())
211 return 1 209 return 1
212 return 0 210 return 0
213 211
214 def _UpdateConfigAndRunTryjob(self, bot_platform, cfg_file_path, arguments): 212 def _UpdateConfigAndRunTryjob(self, bot_platform, cfg_file_path, arguments):
215 """Updates perf config file, uploads changes and excutes perf try job. 213 """Updates perf config file, uploads changes and excutes perf try job.
216 214
217 Args: 215 Args:
218 bot_platform: Name of the platform to be generated. 216 bot_platform: Name of the platform to be generated.
219 cfg_file_path: Perf config file path. 217 cfg_file_path: Perf config file path.
220 218
221 Returns: 219 Returns:
222 (result, msg) where result is one of: 220 (result, msg) where result is one of:
223 SUCCESS if a tryjob was sent 221 SUCCESS if a tryjob was sent
224 NO_CHANGES if there was nothing to try, 222 NO_CHANGES if there was nothing to try,
225 ERROR if a tryjob was attempted but an error encountered 223 ERROR if a tryjob was attempted but an error encountered
226 and msg is an error message if an error was encountered, or rietveld 224 and msg is an error message if an error was encountered, or rietveld
227 url if success, otherwise throws TrybotError exception. 225 url if success, otherwise throws TrybotError exception.
228 """ 226 """
229 config = self._GetPerfConfig(bot_platform, arguments) 227 config = self._GetPerfConfig(bot_platform, arguments)
230 try: 228 try:
231 config_file = open(cfg_file_path, 'w') 229 config_file = open(cfg_file_path, 'w')
232 except IOError: 230 except IOError:
233 msg = 'Cannot find %s. Please run from src dir.' % cfg_file_path 231 msg = 'Cannot find %s.' % cfg_file_path
234 return (ERROR, msg) 232 return (ERROR, msg)
235 config_file.write('config = %s' % json.dumps( 233 config_file.write('config = %s' % json.dumps(
236 config, sort_keys=True, indent=2, separators=(',', ': '))) 234 config, sort_keys=True, indent=2, separators=(',', ': ')))
237 config_file.close() 235 config_file.close()
238 # Commit the config changes locally. 236 # Commit the config changes locally.
239 returncode, out, err = _RunProcess( 237 returncode, out, err = _RunProcess(
240 ['git', 'commit', '-a', '-m', 'bisect config: %s' % bot_platform]) 238 ['git', 'commit', '-a', '-m', 'bisect config: %s' % bot_platform])
241 if returncode: 239 if returncode:
242 raise TrybotError('Could not commit bisect config change for %s,' 240 raise TrybotError('Could not commit bisect config change for %s,'
243 ' error %s' % (bot_platform, err)) 241 ' error %s' % (bot_platform, err))
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 This is run once for chromium, and if it returns NO_CHANGES, once for blink. 313 This is run once for chromium, and if it returns NO_CHANGES, once for blink.
316 314
317 Args: 315 Args:
318 cfg_file_path: Path to the config file for the try job. 316 cfg_file_path: Path to the config file for the try job.
319 317
320 Returns: 318 Returns:
321 Returns SUCCESS if a tryjob was sent, NO_CHANGES if there was nothing to 319 Returns SUCCESS if a tryjob was sent, NO_CHANGES if there was nothing to
322 try, ERROR if a tryjob was attempted but an error encountered. 320 try, ERROR if a tryjob was attempted but an error encountered.
323 """ 321 """
324 source_repo = 'chromium' 322 source_repo = 'chromium'
325 if cfg_file_path == BLINK_CONFIG_FILENAME:
326 source_repo = 'blink'
327 323
328 # TODO(prasadv): This method is quite long, we should consider refactor 324 # TODO(prasadv): This method is quite long, we should consider refactor
329 # this by extracting to helper methods. 325 # this by extracting to helper methods.
330 returncode, original_branchname, err = _RunProcess( 326 returncode, original_branchname, err = _RunProcess(
331 ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) 327 ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
332 if returncode: 328 if returncode:
333 msg = 'Must be in a git repository to send changes to trybots.' 329 msg = 'Must be in a git repository to send changes to trybots.'
334 if err: 330 if err:
335 msg += '\nGit error: %s' % err 331 msg += '\nGit error: %s' % err
336 logging.error(msg) 332 logging.error(msg)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return ERROR # pylint: disable=lost-exception 391 return ERROR # pylint: disable=lost-exception
396 logging.info('Checked out original branch: %s', original_branchname) 392 logging.info('Checked out original branch: %s', original_branchname)
397 returncode, out, err = _RunProcess( 393 returncode, out, err = _RunProcess(
398 ['git', 'branch', '-D', 'telemetry-tryjob']) 394 ['git', 'branch', '-D', 'telemetry-tryjob'])
399 if returncode: 395 if returncode:
400 logging.error('Could not delete telemetry-tryjob branch. ' 396 logging.error('Could not delete telemetry-tryjob branch. '
401 'Please delete it manually: %s', err) 397 'Please delete it manually: %s', err)
402 return ERROR # pylint: disable=lost-exception 398 return ERROR # pylint: disable=lost-exception
403 logging.info('Deleted temp branch: telemetry-tryjob') 399 logging.info('Deleted temp branch: telemetry-tryjob')
404 return SUCCESS 400 return SUCCESS
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/run-perf-test.cfg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698