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

Side by Side Diff: infra/libs/buildbot/master.py

Issue 1116583002: Add connection breakage. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | infra/libs/buildbot/test/master_test.py » ('j') | 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 """Get information about a buildbot master and manipulate it.""" 5 """Get information about a buildbot master and manipulate it."""
6 6
7 7
8 import errno 8 import errno
9 import os 9 import os
10 import json 10 import json
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if port is not None: 134 if port is not None:
135 try: 135 try:
136 res = requests.get( 136 res = requests.get(
137 'http://localhost:%d/json/accepting_builds' % port, 137 'http://localhost:%d/json/accepting_builds' % port,
138 timeout=timeout) 138 timeout=timeout)
139 if res.status_code == 200: 139 if res.status_code == 200:
140 try: 140 try:
141 return res.json().get('accepting_builds') 141 return res.json().get('accepting_builds')
142 except simplejson.scanner.JSONDecodeError: 142 except simplejson.scanner.JSONDecodeError:
143 pass 143 pass
144 except requests.exceptions.Timeout: 144 except requests.exceptions.Timeout:
M-A Ruel 2015/04/29 17:25:07 except (requests.exceptions.ConnectionError, reque
ghost stip (do not use) 2015/04/29 20:48:59 Done.
145 pass 145 pass
146 except requests.exceptions.ConnectionError:
147 pass
146 return None 148 return None
147 149
148 150
149 ######## Performing actions on the master. 151 ######## Performing actions on the master.
150 152
151 153
152 GclientSync, MakeStop, MakeWait, MakeStart, MakeNoNewBuilds = range(5) 154 GclientSync, MakeStop, MakeWait, MakeStart, MakeNoNewBuilds = range(5)
153 155
154 156
155 def convert_action_items_to_cli( 157 def convert_action_items_to_cli(
(...skipping 21 matching lines...) Expand all
177 elif action_item == MakeStop: 179 elif action_item == MakeStop:
178 yield cmd_dict(['make', 'stop'], 'make') 180 yield cmd_dict(['make', 'stop'], 'make')
179 elif action_item == MakeWait: 181 elif action_item == MakeWait:
180 yield cmd_dict(['make', 'wait'], 'make') 182 yield cmd_dict(['make', 'wait'], 'make')
181 elif action_item == MakeStart: 183 elif action_item == MakeStart:
182 yield cmd_dict(['make', 'start'], 'make') 184 yield cmd_dict(['make', 'start'], 'make')
183 elif action_item == MakeNoNewBuilds: 185 elif action_item == MakeNoNewBuilds:
184 yield cmd_dict(['make', 'no-new-builds'], 'make') 186 yield cmd_dict(['make', 'no-new-builds'], 'make')
185 else: 187 else:
186 raise ValueError('Invalid action item %s' % action_item) 188 raise ValueError('Invalid action item %s' % action_item)
OLDNEW
« no previous file with comments | « no previous file | infra/libs/buildbot/test/master_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698