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

Side by Side Diff: appengine/findit/waterfall/swarming_util.py

Issue 2159023002: [Findit] Catch ValueError when get swarming result. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 import base64 5 import base64
6 from collections import defaultdict 6 from collections import defaultdict
7 import json 7 import json
8 import urllib 8 import urllib
9 import zlib 9 import zlib
10 10
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 else the log would be in content so use it directly. 245 else the log would be in content so use it directly.
246 """ 246 """
247 json_content = json.loads(output_json_content) 247 json_content = json.loads(output_json_content)
248 output_json_url = json_content.get('url') 248 output_json_url = json_content.get('url')
249 if output_json_url: 249 if output_json_url:
250 get_content = _SendRequestToServer(output_json_url, http_client) 250 get_content = _SendRequestToServer(output_json_url, http_client)
251 elif json_content.get('content'): 251 elif json_content.get('content'):
252 get_content = base64.b64decode(json_content['content']) 252 get_content = base64.b64decode(json_content['content'])
253 else: # pragma: no cover 253 else: # pragma: no cover
254 get_content = None # Just for precausion. 254 get_content = None # Just for precausion.
255 return json.loads(zlib.decompress(get_content)) if get_content else None 255 try:
256 256 return json.loads(zlib.decompress(get_content)) if get_content else None
257 except ValueError:
258 return None
lijeffrey 2016/07/19 04:43:43 Do we want to add some logging that get_content is
chanli 2016/07/20 20:12:33 Done.
257 259
258 def _DownloadTestResults(isolated_data, http_client): 260 def _DownloadTestResults(isolated_data, http_client):
259 """Downloads the output.json file and returns the json object.""" 261 """Downloads the output.json file and returns the json object."""
260 # First POST request to get hash for the output.json file. 262 # First POST request to get hash for the output.json file.
261 content = _FetchOutputJsonInfoFromIsolatedServer( 263 content = _FetchOutputJsonInfoFromIsolatedServer(
262 isolated_data, http_client) 264 isolated_data, http_client)
263 if not content: 265 if not content:
264 return None 266 return None
265 output_json_hash = _GetOutputJsonHash(content) 267 output_json_hash = _GetOutputJsonHash(content)
266 if not output_json_hash: 268 if not output_json_hash:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 shard_results = [] 345 shard_results = []
344 for isolated_data in list_isolated_data: 346 for isolated_data in list_isolated_data:
345 output_json = _DownloadTestResults(isolated_data, http_client) 347 output_json = _DownloadTestResults(isolated_data, http_client)
346 if not output_json: 348 if not output_json:
347 return None 349 return None
348 shard_results.append(output_json) 350 shard_results.append(output_json)
349 351
350 if len(list_isolated_data) == 1: 352 if len(list_isolated_data) == 1:
351 return shard_results[0] 353 return shard_results[0]
352 return _MergeSwarmingTestShards(shard_results) 354 return _MergeSwarmingTestShards(shard_results)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698