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

Unified Diff: tools/buildbot_globals.py

Issue 99223002: Add some debugging to buildbot_globals, sort the trybot list (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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/submit_try » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/buildbot_globals.py
===================================================================
--- tools/buildbot_globals.py (revision 12387)
+++ tools/buildbot_globals.py (working copy)
@@ -13,17 +13,45 @@
_global_vars = None
+
+GLOBAL_VARS_JSON_URL = (
+ 'http://skia.googlecode.com/svn/buildbot/site_config/global_variables.json')
+
+
+class GlobalVarsRetrievalError(Exception):
+ """Exception which is raised when the global_variables.json file cannot be
+ retrieved from the Skia buildbot repository."""
+ pass
+
+
+class JsonDecodeError(Exception):
+ """Exception which is raised when the global_variables.json file cannot be
+ interpreted as JSON. This may be due to the file itself being incorrectly
+ formatted or due to an incomplete or corrupted downloaded version of the file.
+ """
+ pass
+
+
class NoSuchGlobalVariable(KeyError):
+ """Exception which is raised when a given variable is not found in the
+ global_variables.json file."""
pass
+
def Get(var_name):
'''Return the value associated with this name in global_variables.json.
Raises NoSuchGlobalVariable if there is no variable with that name.'''
global _global_vars
if not _global_vars:
- _global_vars = json.loads(svn.Cat('http://skia.googlecode.com/svn/'
- 'buildbot/site_config/'
- 'global_variables.json'))
+ try:
+ global_vars_text = svn.Cat(GLOBAL_VARS_JSON_URL)
+ except Exception:
+ raise GlobalVarsRetrievalError('Failed to retrieve %s.' %
+ GLOBAL_VARS_JSON_URL)
+ try:
+ _global_vars = json.loads(global_vars_text)
+ except ValueError as e:
+ raise JsonDecodeError(e.message + '\n' + global_vars_text)
try:
return _global_vars[var_name]['value']
except KeyError:
« no previous file with comments | « no previous file | tools/submit_try » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698