Changeset 52404 in webkit


Ignore:
Timestamp:
Dec 20, 2009 12:27:50 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-12-20 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Use memcache to make dashboard to fast
https://bugs.webkit.org/show_bug.cgi?id=32780

  • QueueStatusServer/app.yaml:
  • QueueStatusServer/handlers/dashboard.py:
  • QueueStatusServer/handlers/updatestatus.py:
  • QueueStatusServer/model/attachment.py: Added.
Location:
trunk/WebKitTools
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r52400 r52404  
     12009-12-20  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Use memcache to make dashboard to fast
     6        https://bugs.webkit.org/show_bug.cgi?id=32780
     7
     8        * QueueStatusServer/app.yaml:
     9        * QueueStatusServer/handlers/dashboard.py:
     10        * QueueStatusServer/handlers/updatestatus.py:
     11        * QueueStatusServer/model/attachment.py: Added.
     12
    1132009-12-19  Brent Fulgham  <bfulgham@webkit.org>
    214
  • trunk/WebKitTools/QueueStatusServer/app.yaml

    r52381 r52404  
    88  static_dir: stylesheets
    99
     10- url: /remote_api
     11  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
     12  login: admin
     13
    1014- url: /.*
    1115  script: main.py
  • trunk/WebKitTools/QueueStatusServer/handlers/dashboard.py

    r52396 r52404  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 import re
    30 
    3129from google.appengine.ext import webapp
    3230from google.appengine.ext.webapp import template
    3331
    34 from model.queuestatus import QueueStatus
    35 from handlers.statusbubble import StatusSummary
    36 
    37 queues = [
    38     "style-queue",
    39     "chromium-ews",
    40     "qt-ews",
    41     "gtk-ews",
    42 ]
    43 
    44 def dash_to_underscore(dashed_name):
    45     regexp = re.compile("-")
    46     return regexp.sub("_", dashed_name)
    47 
    48 def state_from_status(status):
    49     table = {
    50         "Pass" : "pass",
    51         "Fail" : "fail",
    52     }
    53     return table.get(status.message, "none")
    54 
    55 def summarize(attachment_id):
    56     summary = { "attachment_id" : attachment_id }
    57 
    58     # FIXME: We shouldn't have to make another query to figure this out.
    59     #        We'll fix this with memcache.  Notice that we can't grab it
    60     #        below because the patch might not have been processed by one
    61     #        these queues yet.
    62     summary["bug_id"] = QueueStatus.all().filter('active_patch_id =', attachment_id).fetch(1)[0].active_bug_id
    63 
    64     for queue in queues:
    65         summary[queue] = None
    66         status = QueueStatus.all().filter('queue_name =', queue).filter('active_patch_id =', attachment_id).order('-date').get()
    67         if status:
    68             summary[dash_to_underscore(queue)] = {
    69                 "state" : state_from_status(status),
    70                 "status" : status,
    71             }
    72     return summary
    73 
     32from model.attachment import Attachment
    7433
    7534class Dashboard(webapp.RequestHandler):
    7635    def get(self):
    77         status_summary = StatusSummary()
    78         statuses = QueueStatus.all().order("-date")
    79 
    80         attachment_ids = set()
    81         for status in statuses:
    82             if not status.active_patch_id:
    83                 continue
    84             attachment_ids.add(status.active_patch_id)
    85             if len(attachment_ids) >= 25:
    86                 break
     36        attachments = Attachment.recent(limit=25)
    8737
    8838        template_values = {
    89             "summaries" : map(summarize, sorted(attachment_ids)),
     39            "summaries" : [attachment.summary() for attachment in attachments],
    9040        }
    9141        self.response.out.write(template.render("templates/dashboard.html", template_values))
  • trunk/WebKitTools/QueueStatusServer/handlers/updatestatus.py

    r52396 r52404  
    3131from google.appengine.ext.webapp import template
    3232
     33from model.attachment import Attachment
    3334from model.queuestatus import QueueStatus
    3435
     
    5354            queue_status.author = users.get_current_user()
    5455
    55         queue_name = self.request.get('queue_name')
     56        bug_id = self._int_from_request("bug_id")
     57        patch_id = self._int_from_request("patch_id")
     58        queue_name = self.request.get("queue_name")
    5659        queue_status.queue_name = queue_name
    57         queue_status.active_bug_id = self._int_from_request('bug_id')
    58         queue_status.active_patch_id = self._int_from_request('patch_id')
    59         queue_status.message = self.request.get('status')
     60        queue_status.active_bug_id = bug_id
     61        queue_status.active_patch_id = patch_id
     62        queue_status.message = self.request.get("status")
    6063        results_file = self.request.get("results_file")
    6164        queue_status.results_file = db.Blob(str(results_file))
    6265        queue_status.put()
     66        Attachment.dirty(patch_id)
    6367        self.response.out.write(queue_status.key().id())
Note: See TracChangeset for help on using the changeset viewer.