Bug 1377221 - Use ignore_nan when dumping talos json blobs r?jmaher draft
authorWilliam Lachance <wlachance@mozilla.com>
Thu, 29 Jun 2017 13:14:02 -0700
changeset 602214 47c9c64e87c0ceff831eb3059d18d613da9ab533
parent 602213 39fc7593a57fcdd6f5ab7dc113dc58877af98d79
child 635518 dcb93d2da1e2b8a552e6b1f74850aa184ec9f8be
push id66343
push userwlachance@mozilla.com
push dateThu, 29 Jun 2017 21:04:13 +0000
reviewersjmaher
bugs1377221
milestone56.0a1
Bug 1377221 - Use ignore_nan when dumping talos json blobs r?jmaher NaN, inf, -inf values are not valid json-- let's just output null instead when we get these values. MozReview-Commit-ID: CxddnTXVs4A
testing/talos/talos/output.py
--- a/testing/talos/talos/output.py
+++ b/testing/talos/talos/output.py
@@ -1,17 +1,17 @@
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """output formats for Talos"""
 
 import filter
-import json
+import simplejson as json
 import utils
 
 from mozlog import get_proxy_logger
 
 # NOTE: we have a circular dependency with output.py when we import results
 import results as TalosResults
 
 LOG = get_proxy_logger()
@@ -189,20 +189,21 @@ class Output(object):
             raise NotImplementedError(
                 "%s: %s - only http://, https://, and file:// supported"
                 % (self.__class__.__name__, results_url)
             )
 
         # This is the output that treeherder expects to find when parsing the
         # log file
         if 'geckoProfile' not in self.results.extra_options:
-            LOG.info("PERFHERDER_DATA: %s" % json.dumps(results))
+            LOG.info("PERFHERDER_DATA: %s" % json.dumps(results,
+                                                        ignore_nan=True))
         if results_scheme in ('file'):
             json.dump(results, open(results_path, 'w'), indent=2,
-                      sort_keys=True)
+                      sort_keys=True, ignore_nan=True)
 
     def post(self, results, server, path, scheme, tbpl_output):
         raise NotImplementedError("Abstract base class")
 
     @classmethod
     def shortName(cls, name):
         """short name for counters"""
         names = {"Working Set": "memset",