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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/submit_try » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Provides read access to buildbot's global_variables.json . 8 Provides read access to buildbot's global_variables.json .
9 """ 9 """
10 10
11 import json 11 import json
12 import svn 12 import svn
13 13
14 _global_vars = None 14 _global_vars = None
15 15
16
17 GLOBAL_VARS_JSON_URL = ('http://skia.googlecode.com/svn/buildbot/site_config/'
epoger 2013/12/02 18:36:28 Personally, I would write it this way so the URL w
borenet 2013/12/02 20:22:24 Done.
18 'global_variables.json')
19
20
21 class GlobalVarsRetrievalError(Exception):
epoger 2013/12/02 18:36:28 Please add docstrings giving a brief description o
borenet 2013/12/02 20:22:24 Done.
22 pass
23
24
25 class JsonDecodeError(Exception):
rmistry 2013/12/02 14:57:12 simplejson has a JSONDecodeError. Also, I wonder i
borenet 2013/12/02 16:26:29 Probably a good decision in the long run. All I c
rmistry 2013/12/02 16:28:24 Makes sense.
26 pass
27
28
16 class NoSuchGlobalVariable(KeyError): 29 class NoSuchGlobalVariable(KeyError):
17 pass 30 pass
18 31
32
19 def Get(var_name): 33 def Get(var_name):
20 '''Return the value associated with this name in global_variables.json. 34 '''Return the value associated with this name in global_variables.json.
21 Raises NoSuchGlobalVariable if there is no variable with that name.''' 35 Raises NoSuchGlobalVariable if there is no variable with that name.'''
22 global _global_vars 36 global _global_vars
23 if not _global_vars: 37 if not _global_vars:
24 _global_vars = json.loads(svn.Cat('http://skia.googlecode.com/svn/' 38 try:
25 'buildbot/site_config/' 39 global_vars_text = svn.Cat(GLOBAL_VARS_JSON_URL)
26 'global_variables.json')) 40 except Exception:
epoger 2013/12/02 18:36:28 TL;DR : this is fine. :-) I wondered what the pro
borenet 2013/12/02 20:22:24 Yeah, I guess this isn't ideal, but losing the sta
41 raise GlobalVarsRetrievalError('Failed to retrieve %s.' %
42 GLOBAL_VARS_JSON_URL)
43 try:
44 _global_vars = json.loads(global_vars_text)
45 except ValueError as e:
46 raise JsonDecodeError(e.message + '\n' + global_vars_text)
27 try: 47 try:
28 return _global_vars[var_name]['value'] 48 return _global_vars[var_name]['value']
29 except KeyError: 49 except KeyError:
30 raise NoSuchGlobalVariable(var_name) 50 raise NoSuchGlobalVariable(var_name)
OLDNEW
« 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