webkit-perf.appspot.com should accept test results without medians
[WebKit-https.git] / Websites / webkit-perf.appspot.com / dashboard_handler.py
index 7973b02cfd583fdf1c69ebcd5f8ec7257903b301..9778fbefda9d0f26425370a95e5df7d6088cf7e4 100644 (file)
@@ -28,6 +28,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import webapp2
+from google.appengine.api import memcache
 
 import json
 
@@ -39,12 +40,18 @@ from models import Test
 
 class DashboardHandler(webapp2.RequestHandler):
     def get(self):
-        webkitTrunk = Branch.get_by_key_name('webkit-trunk')
+        self.response.headers['Content-Type'] = 'application/json; charset=utf-8';
+        cache = memcache.get('dashboard')
+        if cache:
+            self.response.out.write(cache)
+            return
+
+        webkit_trunk = Branch.get_by_key_name('webkit-trunk')
 
         # FIXME: Determine popular branches, platforms, and tests
         dashboard = {
             'defaultBranch': 'WebKit trunk',
-            'branchToId': {webkitTrunk.name: webkitTrunk.id},
+            'branchToId': {webkit_trunk.name: webkit_trunk.id},
             'platformToId': {},
             'testToId': {},
         }
@@ -55,5 +62,6 @@ class DashboardHandler(webapp2.RequestHandler):
         for test in Test.all():
             dashboard['testToId'][test.name] = test.id
 
-        self.response.headers['Content-Type'] = 'application/json; charset=utf-8';
-        self.response.out.write(json.dumps(dashboard))
+        result = json.dumps(dashboard)
+        self.response.out.write(result)
+        memcache.add('dashboard', result)