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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/model/wf_analysis.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/swarming_util.py
diff --git a/appengine/findit/waterfall/swarming_util.py b/appengine/findit/waterfall/swarming_util.py
index d8cad51b9c39cc10c3c6fca143f51a0cd009ac7d..01146372e6d70ae1e39fb6c0dedec379e3a83bcb 100644
--- a/appengine/findit/waterfall/swarming_util.py
+++ b/appengine/findit/waterfall/swarming_util.py
@@ -5,6 +5,7 @@
import base64
from collections import defaultdict
import json
+import logging
import urllib
import zlib
@@ -252,8 +253,12 @@ def _RetrieveOutputJsonFile(output_json_content, http_client):
get_content = base64.b64decode(json_content['content'])
else: # pragma: no cover
get_content = None # Just for precausion.
- return json.loads(zlib.decompress(get_content)) if get_content else None
-
+ try:
+ return json.loads(zlib.decompress(get_content)) if get_content else None
+ except ValueError: # pragma: no cover
+ logging.info(
+ 'swarming result is invalid: %s' % zlib.decompress(get_content))
+ return None
def _DownloadTestResults(isolated_data, http_client):
"""Downloads the output.json file and returns the json object."""
« no previous file with comments | « appengine/findit/model/wf_analysis.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698