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 import logging | 5 import logging |
| 6 import urllib | 6 import urllib |
| 7 | 7 |
| 8 from google.appengine.api import urlfetch | 8 from google.appengine.api import urlfetch |
| 9 | 9 |
| 10 from common.buildbot import build | 10 from common.buildbot import build |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 Raises: | 53 Raises: |
| 54 ValueError: A build number is invalid. | 54 ValueError: A build number is invalid. |
| 55 """ | 55 """ |
| 56 if not build_numbers: | 56 if not build_numbers: |
| 57 return | 57 return |
| 58 | 58 |
| 59 for build_number in build_numbers: | 59 for build_number in build_numbers: |
| 60 if build_number < 0: | 60 if build_number < 0: |
| 61 raise ValueError('Invalid build number: %d' % build_number) | 61 raise ValueError('Invalid build number: %d' % build_number) |
| 62 | 62 |
| 63 build_query = urllib.urlencode( | 63 builds = [] |
| 64 [('select', build_number) for build_number in build_numbers]) | 64 for build_number in build_numbers: |
| 65 url = 'json/builders/%s/builds/?%s' % ( | 65 url = 'json/builders/%s/builds/%d' % ( |
| 66 urllib.quote(self._builder_name), build_query) | 66 urllib.quote(self._builder_name), build_number) |
| 67 url = network.BuildUrl(self._master_name, url) | 67 url = network.BuildUrl(self._master_name, url, use_cbe=True) |
| 68 try: | 68 try: |
| 69 builds = network.FetchData(url).values() | 69 builds.append(network.FetchData(url)) |
| 70 except (ValueError, urlfetch.ResponseTooLargeError): | 70 except (ValueError, urlfetch.ResponseTooLargeError): |
|
martiniss
2016/10/06 22:56:33
I removed this logic because CBE doesn't support t
dtu
2016/10/07 17:10:55
Yeah, that's fine. It was only because BuildBot wa
| |
| 71 # The JSON decode failed, or the data was too large. | 71 logging.warning('Unable to fetch %s/%s build %d', |
| 72 # Try downloading the builds individually instead. | 72 self._master_name, self._builder_name, build_number) |
| 73 builds = [] | 73 continue |
| 74 for build_number in build_numbers: | |
| 75 url = 'json/builders/%s/builds/%d' % ( | |
| 76 urllib.quote(self._builder_name), build_number) | |
| 77 url = network.BuildUrl(self._master_name, url) | |
| 78 try: | |
| 79 builds.append(network.FetchData(url)) | |
| 80 except (ValueError, urlfetch.ResponseTooLargeError): | |
| 81 logging.warning('Unable to fetch %s build %d', | |
| 82 self._master_name, build_number) | |
| 83 continue | |
| 84 | 74 |
| 85 for build_data in builds: | 75 for build_data in builds: |
| 86 if 'error' in build_data: | 76 if 'error' in build_data: |
| 87 continue | 77 continue |
| 88 yield build.Build(build_data, self._url) | 78 yield build.Build(build_data, self._url) |
| OLD | NEW |