Changeset 68453 in webkit


Ignore:
Timestamp:
Sep 27, 2010 5:14:21 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-09-27 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

queue-status should report when the patch was last locked to a queue
https://bugs.webkit.org/show_bug.cgi?id=46674

This isn't necessarily the best way to expose this information
but having this accessible via the web interface is very
useful until we come up with a nicer way to display this.

I also cleaned up the code in activeworkitems.py a little
to use list comprehensions and to have the code work with
pairs instead of two lists at once. Eventually I think those
item/time pairs need to be their own little helper class.

  • QueueStatusServer/handlers/queuestatus.py:
  • QueueStatusServer/model/activeworkitems.py:
  • QueueStatusServer/templates/queuestatus.html:
Location:
trunk/WebKitTools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r68451 r68453  
     12010-09-27  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        queue-status should report when the patch was last locked to a queue
     6        https://bugs.webkit.org/show_bug.cgi?id=46674
     7
     8        This isn't necessarily the best way to expose this information
     9        but having this accessible via the web interface is very
     10        useful until we come up with a nicer way to display this.
     11
     12        I also cleaned up the code in activeworkitems.py a little
     13        to use list comprehensions and to have the code work with
     14        pairs instead of two lists at once.  Eventually I think those
     15        item/time pairs need to be their own little helper class.
     16
     17        * QueueStatusServer/handlers/queuestatus.py:
     18        * QueueStatusServer/model/activeworkitems.py:
     19        * QueueStatusServer/templates/queuestatus.html:
     20
    1212010-09-27  Tony Chang  <tony@chromium.org>
    222
  • trunk/WebKitTools/QueueStatusServer/handlers/queuestatus.py

    r67584 r68453  
    3232from model.queues import queues, display_name_for_queue
    3333from model.workitems import WorkItems
     34from model.activeworkitems import ActiveWorkItems
    3435
    3536from model import queuestatus
     
    3738
    3839class QueueStatus(webapp.RequestHandler):
    39     def _rows_for_work_items(self, work_items):
    40         if not work_items:
     40    def _rows_for_work_items(self, queued_items, active_items):
     41        if not queued_items:
    4142            return []
    4243        rows = []
    43         for item_id in work_items.item_ids:
     44        for item_id in queued_items.item_ids:
    4445            rows.append({
    4546                "attachment_id": item_id,
    4647                "bug_id": 1,
     48                "lock_time": active_items and active_items.time_for_item(item_id),
    4749            })
    4850        return rows
    4951
    5052    def get(self, queue_name):
    51         work_items = WorkItems.all().filter("queue_name =", queue_name).get()
     53        queued_items = WorkItems.all().filter("queue_name =", queue_name).get()
     54        active_items = ActiveWorkItems.all().filter("queue_name =", queue_name).get()
    5255        statuses = queuestatus.QueueStatus.all().filter("queue_name =", queue_name).order("-date").fetch(15)
    5356
     
    6871        template_values = {
    6972            "display_queue_name": display_name_for_queue(queue_name),
    70             "work_item_rows": self._rows_for_work_items(work_items),
     73            "work_item_rows": self._rows_for_work_items(queued_items, active_items),
    7174            "status_groups": status_groups,
    7275        }
  • trunk/WebKitTools/QueueStatusServer/model/activeworkitems.py

    r67893 r68453  
    2929from google.appengine.ext import db
    3030
    31 from datetime import timedelta
     31from datetime import timedelta, datetime
    3232import time
    3333
     
    3939    date = db.DateTimeProperty(auto_now_add=True)
    4040
     41    # The id/date pairs should probably just be their own class.
     42    def _item_time_pairs(self):
     43        return zip(self.item_ids, self.item_dates)
     44
     45    def _set_item_time_pairs(self, pairs):
     46        if not pairs:
     47            self.item_ids = []
     48            self.item_dates = []
     49            return
     50        self.item_ids, self.item_dates = zip(*pairs)
     51
     52    def _append_item_time_pair(self, pair):
     53        self.item_ids.append(pair[0])
     54        self.item_dates.append(pair[1])
     55
    4156    def deactivate_expired(self, now):
    4257        one_hour_ago = time.mktime((now - timedelta(minutes=60)).timetuple())
    43         nonexpired_item_ids = []
    44         nonexpired_item_dates = []
    45         for i in range(len(self.item_ids)):
    46             if self.item_dates[i] > one_hour_ago:
    47                 nonexpired_item_ids.append(self.item_ids[i])
    48                 nonexpired_item_dates.append(self.item_dates[i])
    49         self.item_ids = nonexpired_item_ids
    50         self.item_dates = nonexpired_item_dates
     58        nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[1] > one_hour_ago]
     59        self._set_item_time_pairs(nonexpired_pairs)
    5160
    5261    def next_item(self, work_item_ids, now):
    5362        for item_id in work_item_ids:
    5463            if item_id not in self.item_ids:
    55                 self.item_ids.append(item_id)
    56                 self.item_dates.append(time.mktime(now.timetuple()))
     64                self._append_item_time_pair([item_id, time.mktime(now.timetuple())])
    5765                return item_id
    5866        return None
     67
     68    def time_for_item(self, item_id):
     69        for active_item_id, time in self._item_time_pairs():
     70            if active_item_id == item_id:
     71                return datetime.fromtimestamp(time)
     72        return None
  • trunk/WebKitTools/QueueStatusServer/templates/queuestatus.html

    r67584 r68453  
    4343<h3>Patches in queue</h3>
    4444<table>
    45     <tr><th>Position</th><th>Patch</th></tr>
     45    <tr><th>Position</th><th>Patch</th><th>Last Activity</th></tr>
    4646    {% for row in work_item_rows %}
    4747    <tr>
     
    4949        <td>
    5050          {{ row.attachment_id|force_escape|webkit_attachment_id|safe }}
     51        </td>
     52        <td>
     53            {% if row.lock_time %}
     54                {{ row.lock_time|timesince }} ago
     55            {% endif %}
    5156        </td>
    5257    </tr>
Note: See TracChangeset for help on using the changeset viewer.