Changeset 107274 in webkit
- Timestamp:
- Feb 9, 2012, 12:20:41 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
-
ChangeLog (modified) (1 diff)
-
Websites/webkit-perf.appspot.com/app.yaml (modified) (1 diff)
-
Websites/webkit-perf.appspot.com/controller.py (added)
-
Websites/webkit-perf.appspot.com/create_handler.py (modified) (3 diffs)
-
Websites/webkit-perf.appspot.com/dashboard_handler.py (modified) (3 diffs)
-
Websites/webkit-perf.appspot.com/main.py (modified) (2 diffs)
-
Websites/webkit-perf.appspot.com/manifest_handler.py (modified) (3 diffs)
-
Websites/webkit-perf.appspot.com/merge_tests_handler.py (modified) (2 diffs)
-
Websites/webkit-perf.appspot.com/report_handler.py (modified) (4 diffs)
-
Websites/webkit-perf.appspot.com/runs_handler.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r107250 r107274 1 2012-02-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Perf-o-matic should update memcache in taskqueue 4 https://bugs.webkit.org/show_bug.cgi?id=78209 5 6 Reviewed by Adam Barth. 7 8 Update dashboard, manifest, and runs memcaches in taskqueue. 9 Also centralized the management of caches in controller.py. 10 11 * Websites/webkit-perf.appspot.com/app.yaml: 12 * Websites/webkit-perf.appspot.com/controller.py: Added. 13 (cache_manifest): 14 (schedule_manifest_update): 15 (CachedManifestHandler): 16 (CachedManifestHandler.get): 17 (cache_dashboard): 18 (schedule_dashboard_update): 19 (CachedDashboardHandler): 20 (CachedDashboardHandler.get): 21 (cache_runs): 22 (schedule_runs_update): 23 (CachedRunsHandler): 24 (CachedRunsHandler.get): 25 * Websites/webkit-perf.appspot.com/create_handler.py: 26 (CreateHandler.post): 27 * Websites/webkit-perf.appspot.com/dashboard_handler.py: 28 (DashboardHandler.post): 29 * Websites/webkit-perf.appspot.com/main.py: 30 * Websites/webkit-perf.appspot.com/manifest_handler.py: 31 (ManifestHandler.post): 32 * Websites/webkit-perf.appspot.com/merge_tests_handler.py: 33 (MergeTestsHandler.post): 34 * Websites/webkit-perf.appspot.com/report_handler.py: 35 (ReportHandler.post): 36 * Websites/webkit-perf.appspot.com/runs_handler.py: 37 (RunsHandler.post): 38 1 39 2012-02-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 40 -
trunk/Websites/webkit-perf.appspot.com/app.yaml
r106890 r107274 1 1 application: webkit-perf 2 version: 1 12 version: 12 3 3 runtime: python27 4 4 api_version: 1 -
trunk/Websites/webkit-perf.appspot.com/create_handler.py
r106321 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 31 from google.appengine.ext import db 33 32 34 33 import json 35 34 35 from controller import schedule_dashboard_update 36 36 from models import Builder 37 37 from models import Branch … … 43 43 class CreateHandler(webapp2.RequestHandler): 44 44 def post(self, model): 45 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' ;45 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 46 46 47 47 try: … … 64 64 65 65 # No need to clear manifest or runs since they only contain ones with test results 66 memcache.delete('dashboard')66 schedule_dashboard_update() 67 67 self.response.out.write(error + '\n' if error else 'OK') 68 68 -
trunk/Websites/webkit-perf.appspot.com/dashboard_handler.py
r106321 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 33 31 import json 34 32 33 from controller import cache_dashboard 35 34 from models import Builder 36 35 from models import Branch … … 40 39 41 40 class DashboardHandler(webapp2.RequestHandler): 42 def get(self):43 self.response.headers['Content-Type'] = ' application/json; charset=utf-8';44 cache = memcache.get('dashboard')45 if cache:46 self.response.out.write( cache)41 def post(self): 42 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 43 webkit_trunk = Branch.get_by_key_name('webkit-trunk') 44 if not webkit_trunk: 45 self.response.out.write("BAD: no webkit-trunk") 47 46 return 48 49 webkit_trunk = Branch.get_by_key_name('webkit-trunk')50 47 51 48 # FIXME: Determine popular branches, platforms, and tests … … 63 60 dashboard['testToId'][test.name] = test.id 64 61 65 result = json.dumps(dashboard) 66 self.response.out.write(result) 67 memcache.add('dashboard', result) 62 cache_dashboard(json.dumps(dashboard)) 63 self.response.out.write('OK') -
trunk/Websites/webkit-perf.appspot.com/main.py
r106292 r107274 21 21 import json 22 22 23 from controller import CachedDashboardHandler 24 from controller import CachedManifestHandler 25 from controller import CachedRunsHandler 23 26 from create_handler import CreateHandler 24 27 from dashboard_handler import DashboardHandler … … 33 36 ('/admin/merge-tests/?', MergeTestsHandler), 34 37 ('/admin/create/(.*)', CreateHandler), 35 ('/api/test/?', ManifestHandler), 38 ('/api/test/?', CachedManifestHandler), 39 ('/api/test/update', ManifestHandler), 36 40 ('/api/test/report/?', ReportHandler), 37 ('/api/test/runs/?', RunsHandler), 38 ('/api/test/dashboard/?', DashboardHandler), 41 ('/api/test/runs/?', CachedRunsHandler), 42 ('/api/test/runs/update', RunsHandler), 43 ('/api/test/dashboard/?', CachedDashboardHandler), 44 ('/api/test/dashboard/update', DashboardHandler), 39 45 ] 40 46 -
trunk/Websites/webkit-perf.appspot.com/manifest_handler.py
r106334 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 31 33 32 import json 34 33 34 from controller import cache_manifest 35 35 from models import Builder 36 36 from models import Branch … … 40 40 41 41 class ManifestHandler(webapp2.RequestHandler): 42 def get(self): 43 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'; 44 cache = memcache.get('manifest') 45 if cache: 46 self.response.out.write(cache) 47 return 42 def post(self): 43 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 48 44 49 45 test_map = {} … … 89 85 } 90 86 91 result = json.dumps({'testMap': test_map, 'platformMap': platform_map, 'branchMap': branch_map}) 92 self.response.out.write(result) 93 memcache.add('manifest', result) 87 cache_manifest(json.dumps({'testMap': test_map, 'platformMap': platform_map, 'branchMap': branch_map})) 88 self.response.out.write('OK') -
trunk/Websites/webkit-perf.appspot.com/merge_tests_handler.py
r106321 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 31 from google.appengine.ext.webapp import template 33 32 34 33 import os 35 34 35 from controller import schedule_runs_update 36 from controller import schedule_dashboard_update 37 from controller import schedule_manifest_update 36 38 from models import Test 37 39 from models import TestResult … … 54 56 merged_results = TestResult.all() 55 57 merged_results.filter('name =', merge.name) 58 branches_and_platforms_to_update = set() 56 59 for result in merged_results: 60 branches_and_platforms_to_update.add((result.build.branch.id, result.build.platform.id)) 57 61 result.name = into.name 58 62 result.put() 59 63 60 # Just flush everyting since we rarely merge tests and we need to flush 61 # dashboard, manifest, and all runs for this test here. 62 memcache.flush_all() 64 for branch_id, platform_id in branches_and_platforms_to_update: 65 schedule_runs_update(into.id, branch_id, platform_id) 66 67 schedule_dashboard_update() 68 schedule_manifest_update() 63 69 64 70 delete_model_with_numeric_id_holder(merge) -
trunk/Websites/webkit-perf.appspot.com/report_handler.py
r106687 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 31 from google.appengine.ext import db 33 32 … … 37 36 from datetime import datetime 38 37 38 from controller import schedule_runs_update 39 from controller import schedule_dashboard_update 40 from controller import schedule_manifest_update 39 41 from models import Builder 40 42 from models import Branch … … 96 98 for test_name, result in self._body['results'].iteritems(): 97 99 test = self._add_test_if_needed(test_name, branch, platform) 98 memcache.delete(Test.cache_key(test.id, branch.id, platform.id))100 schedule_runs_update(test.id, branch.id, platform.id) 99 101 if isinstance(result, dict): 100 102 TestResult(name=test_name, build=build, value=float(result['avg']), valueMedian=_float_or_none(result, 'median'), … … 107 109 108 110 # We need to update dashboard and manifest because they are affected by the existance of test results 109 memcache.delete('dashboard')110 memcache.delete('manifest')111 schedule_dashboard_update() 112 schedule_manifest_update() 111 113 112 114 return self._output('OK') -
trunk/Websites/webkit-perf.appspot.com/runs_handler.py
r106890 r107274 29 29 30 30 import webapp2 31 from google.appengine.api import memcache32 31 33 32 import json … … 35 34 from datetime import datetime 36 35 36 from controller import cache_runs 37 37 from models import Build 38 38 from models import Builder … … 46 46 47 47 class RunsHandler(webapp2.RequestHandler): 48 def get(self):49 self.response.headers['Content-Type'] = ' application/json; charset=utf-8'48 def post(self): 49 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 50 50 51 51 try: … … 61 61 # FIXME: Just fetch builds specified by "days" 62 62 # days = self.request.get('days', 365) 63 64 cache_key = Test.cache_key(test_id, branch_id, platform_id)65 cache = memcache.get(cache_key)66 if cache:67 self.response.out.write(cache)68 return69 63 70 64 builds = Build.all() … … 106 100 'date_range': [min(timestamps), max(timestamps)] if timestamps else None, 107 101 'stat': 'ok'}) 108 self.response.out.write(result)109 memcache.add(cache_key, result)102 cache_runs(test_id, branch_id, platform_id, result) 103 self.response.out.write('OK')
Note:
See TracChangeset
for help on using the changeset viewer.