Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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) |
| OLD | NEW |