Unreviewed perf-o-matic build fix for dashboard image generation.
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jul 2012 00:08:44 +0000 (00:08 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jul 2012 00:08:44 +0000 (00:08 +0000)
Also, only show Parser/html5-full-render on the dashboard by default
so that it won't take forever to load it.

* Websites/webkit-perf.appspot.com/controller.py:
(schedule_runs_update):
(RunsChartHandler.post):
* Websites/webkit-perf.appspot.com/models.py:
(Runs.chart_params):
(DashboardImage.get_image):
* Websites/webkit-perf.appspot.com/models_unittest.py:
(RunsTest.test_chart_params_with_value):

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

ChangeLog
Websites/webkit-perf.appspot.com/app.yaml
Websites/webkit-perf.appspot.com/controller.py
Websites/webkit-perf.appspot.com/models.py
Websites/webkit-perf.appspot.com/models_unittest.py

index 7189b1e..850e78b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-07-27  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Unreviewed perf-o-matic build fix for dashboard image generation.
+        Also, only show Parser/html5-full-render on the dashboard by default
+        so that it won't take forever to load it.
+
+        * Websites/webkit-perf.appspot.com/controller.py:
+        (schedule_runs_update):
+        (RunsChartHandler.post):
+        * Websites/webkit-perf.appspot.com/models.py:
+        (Runs.chart_params):
+        (DashboardImage.get_image):
+        * Websites/webkit-perf.appspot.com/models_unittest.py:
+        (RunsTest.test_chart_params_with_value):
+
 2012-07-27  Dominik Röttsches  <dominik.rottsches@intel.com>
 
         [Cairo] Add complex font drawing using HarfbuzzNG
index 5e262a1..a72d863 100644 (file)
@@ -1,5 +1,5 @@
 application: webkit-perf
-version: 18
+version: 19
 runtime: python27
 api_version: 1
 threadsafe: false
index 492ad38..1d7e0d0 100644 (file)
@@ -88,10 +88,8 @@ class CachedDashboardHandler(webapp2.RequestHandler):
 def schedule_runs_update(test_id, branch_id, platform_id, regenerate_runs=True):
     if regenerate_runs:
         taskqueue.add(url='/api/test/runs/update', params={'id': test_id, 'branchid': branch_id, 'platformid': platform_id})
-    for display_days in [7]:
-        if DashboardImage.needs_update(branch_id, platform_id, test_id, display_days):
-            taskqueue.add(url='/api/test/runs/chart', params={'id': test_id, 'branchid': branch_id, 'platformid': platform_id,
-                'displayDays': display_days})
+    taskqueue.add(url='/api/test/runs/chart', params={'id': test_id, 'branchid': branch_id, 'platformid': platform_id,
+        'displayDays': 7})
 
 
 def _get_test_branch_platform_ids(handler):
@@ -135,6 +133,7 @@ class CachedRunsHandler(webapp2.RequestHandler):
 
 class RunsChartHandler(webapp2.RequestHandler):
     def post(self):
+        x = 0
         self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
         test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
 
@@ -145,7 +144,6 @@ class RunsChartHandler(webapp2.RequestHandler):
         assert branch
         assert platform
         assert test
-
         params = Runs.update_or_insert(branch, platform, test).chart_params(display_days)
         if not params:
             return
index 7976891..148da6e 100644 (file)
@@ -452,24 +452,23 @@ class Runs(db.Model):
             self.json_averages, str(self.json_min) if self.json_min else 'null', str(self.json_max) if self.json_max else 'null',
             '"%s"' % self.test.unit if self.test.unit else 'null')
 
-    def chart_params(self, display_days, now=datetime.utcnow().replace(hour=12, minute=0, second=0, microsecond=0)):
+    def chart_params(self, display_days):
         chart_data_x = []
         chart_data_y = []
-        end_time = now
-        start_timestamp = mktime((end_time - timedelta(display_days)).timetuple())
-        end_timestamp = mktime(end_time.timetuple())
+        runs = json.loads('[' + self.json_runs + ']')
+        if not runs:
+            return None
 
-        for entry in json.loads('[' + self.json_runs + ']'):
+        end_timestamp = Runs._timestamp_and_value_from_json_entry(runs[-1])[0]
+        start_timestamp = end_timestamp - display_days * 24 * 3600
+        for entry in runs:
             timestamp, value = Runs._timestamp_and_value_from_json_entry(entry)
             if timestamp < start_timestamp or timestamp > end_timestamp:
                 continue
             chart_data_x.append(timestamp)
             chart_data_y.append(value)
 
-        if not chart_data_y:
-            return None
-
-        dates = [end_time - timedelta(display_days / 7.0 * (7 - i)) for i in range(0, 8)]
+        dates = [datetime.fromtimestamp(end_timestamp) - timedelta(display_days / 7.0 * (7 - i)) for i in range(0, 8)]
 
         y_max = max(chart_data_y) * 1.1
         y_axis_label_step = int(y_max / 5 + 0.5)  # This won't work for decimal numbers
@@ -508,7 +507,7 @@ class DashboardImage(db.Model):
         image = memcache.get('dashboard-image:' + key_name)
         if not image:
             instance = DashboardImage.get_by_key_name(key_name)
-            image = instance.image
+            image = instance.image if instance else None
             memcache.set('dashboard-image:' + key_name, image)
         return image
 
index 50cade5..2305986 100644 (file)
@@ -780,7 +780,7 @@ class RunsTest(DataStoreTestsBase):
         def split_as_int(string):
             return [int(float(value)) for value in string.split(',')]
 
-        params = Runs.update_or_insert(some_branch, some_platform, some_test).chart_params(7, end_time)
+        params = Runs.update_or_insert(some_branch, some_platform, some_test).chart_params(7)
         self.assertEqual(params['chxl'], '0:|Feb 21|Feb 22|Feb 23|Feb 24|Feb 25|Feb 26|Feb 27|Feb 28')
         self.assertEqual(split_as_int(params['chxr']), [1, 0, 57, int(52 * 1.1 / 5 + 0.5)])
         x_min, x_max, y_min, y_max = split_as_int(params['chds'])
@@ -790,7 +790,7 @@ class RunsTest(DataStoreTestsBase):
         self.assertEqual(y_max, int(52 * 1.1))
         self.assertEqual(split_as_int(params['chg']), [int(100 / 7), 20, 0, 0])
 
-        params = Runs.update_or_insert(some_branch, some_platform, some_test).chart_params(14, end_time)
+        params = Runs.update_or_insert(some_branch, some_platform, some_test).chart_params(14)
         self.assertEqual(params['chxl'], '0:|Feb 14|Feb 16|Feb 18|Feb 20|Feb 22|Feb 24|Feb 26|Feb 28')
         self.assertEqual(split_as_int(params['chxr']), [1, 0, 57, int(52 * 1.1 / 5 + 0.5)])
         x_min, x_max, y_min, y_max = split_as_int(params['chds'])