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

Unified Diff: tools/perf/core/trybot_command.py

Issue 1765483002: [tools/perf] Skip try job run if trybot config file does not change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | tools/perf/core/trybot_command_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/core/trybot_command.py
diff --git a/tools/perf/core/trybot_command.py b/tools/perf/core/trybot_command.py
index 8d145f0c7d2453a8e3a41ab49f2016ce9a85d7d8..87699398292f4d280da67871a6db846f99e001c7 100644
--- a/tools/perf/core/trybot_command.py
+++ b/tools/perf/core/trybot_command.py
@@ -244,14 +244,19 @@ class Trybot(command_line.ArgParseCommand):
url if success, otherwise throws TrybotError exception.
"""
config = self._GetPerfConfig(bot_platform, arguments)
+ config_to_write = 'config = %s' % json.dumps(
+ config, sort_keys=True, indent=2, separators=(',', ': '))
+
try:
- config_file = open(cfg_file_path, 'w')
+ with open(cfg_file_path, 'r') as config_file:
+ if config_to_write == config_file.read():
+ return NO_CHANGES, ''
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()
+
+ with open(cfg_file_path, 'w') as config_file:
+ config_file.write(config_to_write)
# Commit the config changes locally.
returncode, out, err = _RunProcess(
['git', 'commit', '-a', '-m', 'bisect config: %s' % bot_platform])
@@ -394,8 +399,12 @@ class Trybot(command_line.ArgParseCommand):
if results == ERROR:
logging.error(output)
return ERROR
- print ('Uploaded %s try job to rietveld for %s platform. '
- 'View progress at %s' % (source_repo, bot_platform, output))
+ elif results == NO_CHANGES:
+ print ('Skip the try job run on %s because it has been tried in '
+ 'previous try job run. ' % bot_platform)
+ else:
sullivan 2016/03/03 06:31:59 Shouldn't this use logging api?
nednguyen 2016/03/03 06:52:23 I am unsure with logging to use, error, warning &
+ print ('Uploaded %s try job to rietveld for %s platform. '
+ 'View progress at %s' % (source_repo, bot_platform, output))
except TrybotError, err:
print err
logging.error(err)
« no previous file with comments | « no previous file | tools/perf/core/trybot_command_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698