webkit-perf.appspot.com should accept test results without medians
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 07:47:08 +0000 (07:47 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 07:47:08 +0000 (07:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77513

Reviewed by Hajime Morita.

Don't store 0s when values are not in JSON.

* Websites/webkit-perf.appspot.com/report_handler.py:
(ReportHandler.post._float_or_none):
(ReportHandler.post):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Websites/webkit-perf.appspot.com/report_handler.py

index ef346597dd0e5cfc98a16ddb183f27ec1863ad8e..b46b38fe329a0767df05881ea185365b130cbf7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-01-31  Ryosuke Niwa  <rniwa@webkit.org>
+
+        webkit-perf.appspot.com should accept test results without medians
+        https://bugs.webkit.org/show_bug.cgi?id=77513
+
+        Reviewed by Hajime Morita.
+
+        Don't store 0s when values are not in JSON.
+
+        * Websites/webkit-perf.appspot.com/report_handler.py:
+        (ReportHandler.post._float_or_none):
+        (ReportHandler.post):
+
 2012-01-31  Kenneth Rohde Christiansen  <kenneth@webkit.org>
 
         Tap highlighting: Support better outlines for multiline inlines
index 39e1fa72bab33ddaa5373b1a74e182b8ea670d18..ce832871e85b9bca31e65e21d5080720a6c73270 100644 (file)
@@ -86,12 +86,18 @@ class ReportHandler(webapp2.RequestHandler):
         if not build:
             return
 
+        def _float_or_none(dictionary, key):
+            value = dictionary.get(key)
+            if value:
+                return float(value)
+            return None
+
         for test_name, result in self._body['results'].iteritems():
             test = self._add_test_if_needed(test_name, branch, platform)
             memcache.delete(Test.cache_key(test.id, branch.id, platform.id))
             if isinstance(result, dict):
-                TestResult(name=test_name, build=build, value=float(result.get('avg', 0)), valueMedian=float(result.get('median', 0)),
-                    valueStdev=float(result.get('stdev', 0)), valueMin=float(result.get('min', 0)), valueMax=float(result.get('max', 0))).put()
+                TestResult(name=test_name, build=build, value=float(result['avg']), valueMedian=_float_or_none(result, 'median'),
+                    valueStdev=_float_or_none(result, 'stdev'), valueMin=_float_or_none(result, 'min'), valueMax=_float_or_none(result, 'max')).put()
             else:
                 TestResult(name=test_name, build=build, value=float(result)).put()