Changeset 51264 in webkit


Ignore:
Timestamp:
Nov 20, 2009 5:02:41 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-11-20 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Teach the StatusBot how to support more than just the commit-queue
https://bugs.webkit.org/show_bug.cgi?id=31754

  • CommitQueueStatus/index.yaml:
    • Add indices required for the new queries.
  • CommitQueueStatus/queue_status.py:
    • Add a patch-status page and move update_status to update-status.
    • Only display "commit-queue" status records for the commit-queue.
    • Add support for a queue_name property on status records.
    • Fix _int_from_request to actually work.
  • CommitQueueStatus/update_status.html:
    • Add support for a queue_name on status records.
    • Remove unused list of bug ids.
    • Scripts/modules/commands/queues.py
      • Make the queues pass the patch instead of the bug_id to StatusBot.
  • Scripts/modules/statusbot.py:
    • Support passing the queue_name to the status updates.
    • Support fetching patch status with patch_status().
  • Scripts/modules/workqueue.py:
    • Pass the patch to the StatusBot instead of the bug_id.
    • Let WorkQueues have a name.
Location:
trunk/WebKitTools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51263 r51264  
     12009-11-20  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Teach the StatusBot how to support more than just the commit-queue
     6        https://bugs.webkit.org/show_bug.cgi?id=31754
     7
     8        * CommitQueueStatus/index.yaml:
     9         - Add indices required for the new queries.
     10        * CommitQueueStatus/queue_status.py:
     11         - Add a patch-status page and move update_status to update-status.
     12         - Only display "commit-queue" status records for the commit-queue.
     13         - Add support for a queue_name property on status records.
     14         - Fix _int_from_request to actually work.
     15        * CommitQueueStatus/update_status.html:
     16         - Add support for a queue_name on status records.
     17         - Remove unused list of bug ids.
     18         * Scripts/modules/commands/queues.py
     19          - Make the queues pass the patch instead of the bug_id to StatusBot.
     20        * Scripts/modules/statusbot.py:
     21         - Support passing the queue_name to the status updates.
     22         - Support fetching patch status with patch_status().
     23        * Scripts/modules/workqueue.py:
     24         - Pass the patch to the StatusBot instead of the bug_id.
     25         - Let WorkQueues have a name.
     26
    1272009-11-20  Adam Barth  <abarth@webkit.org>
    228
  • trunk/WebKitTools/CommitQueueStatus/index.yaml

    r48730 r51264  
    1010# automatically uploaded to the admin console when you next deploy
    1111# your application using appcfg.py.
     12
     13- kind: QueueStatus
     14  properties:
     15  - name: active_patch_id
     16  - name: queue_name
     17  - name: date
     18    direction: desc
     19
     20- kind: QueueStatus
     21  properties:
     22  - name: queue_name
     23  - name: date
     24    direction: desc
  • trunk/WebKitTools/CommitQueueStatus/queue_status.py

    r48730 r51264  
    4242webapp.template.register_template_library('filters.webkit_extras')
    4343
     44
    4445class QueueStatus(db.Model):
    4546    author = db.UserProperty()
     47    queue_name = db.StringProperty()
    4648    active_bug_id = db.IntegerProperty()
    4749    active_patch_id = db.IntegerProperty()
     
    4951    date = db.DateTimeProperty(auto_now_add=True)
    5052
     53
    5154class MainPage(webapp.RequestHandler):
    5255    def get(self):
    53         statuses_query = QueueStatus.all().order('-date')
     56        statuses_query = QueueStatus.all().filter('queue_name =', 'commit-queue').order('-date')
    5457        statuses = statuses_query.fetch(6)
     58        if not statuses:
     59            return self.response.out.write("No status to report.")
    5560        template_values = {
    5661            'last_status' : statuses[0],
     
    5863        }
    5964        self.response.out.write(template.render('index.html', template_values))
     65
     66
     67class PatchStatus(webapp.RequestHandler):
     68    def get(self, queue_name, attachment_id):
     69        statuses = QueueStatus.all().filter('queue_name =', queue_name).filter('active_patch_id =', attachment_id).order('-date')
     70        if not statuses:
     71            self.error(404)
     72        self.response.out.write(statuses[0].message)
     73
    6074
    6175class UpdateStatus(webapp.RequestHandler):
     
    6781        try:
    6882            int_value = int(string_value)
     83            return int_value
    6984        except ValueError, TypeError:
    7085            pass
     
    7792            queue_status.author = users.get_current_user()
    7893
     94        queue_name = self.request.get('queue_name')
     95        queue_status.queue_name = queue_name
    7996        queue_status.active_bug_id = self._int_from_request('bug_id')
    8097        queue_status.active_patch_id = self._int_from_request('patch_id')
     
    83100        self.redirect('/')
    84101
     102
    85103routes = [
    86104    ('/', MainPage),
    87     ('/update_status', UpdateStatus)
     105    ('/update-status', UpdateStatus),
     106    (r'/patch-status/(.*)/(.*)', PatchStatus),
    88107]
    89108
  • trunk/WebKitTools/CommitQueueStatus/update_status.html

    r48730 r51264  
    1 Update the current status of the commit-queue:
    21<form name="update_status" method="post">
     2Update status for a queue: <input name="queue_name">
    33 <div>
    44     Active Bug Id:
     
    99    <input name="patch_id">
    1010 </div>
    11  <div>
    12      Space separated list of other bugs in queue:
    13     <input name="bugs_in_queue">
    14  </div>
    1511  <div>
     12      Status Text:<br>
    1613      <textarea name="status" rows="3" cols="60"></textarea>
    1714  </div>
  • trunk/WebKitTools/Scripts/modules/commands/queues.py

    r51263 r51264  
    107107        self.options = options
    108108        self.tool = tool
    109         work_queue = WorkQueue(self)
     109        work_queue = WorkQueue(self, self.name)
    110110        work_queue.run()
    111111
     
    132132            red_builders_names = map(lambda name: "\"%s\"" % name, red_builders_names) # Add quotes around the names.
    133133            return (False, "Builders [%s] are red. See http://build.webkit.org." % ", ".join(red_builders_names), None)
    134         return (True, "Landing patch %s from bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
     134        return (True, "Landing patch %s from bug %s." % (patch["id"], patch["bug_id"]), patch)
    135135
    136136    def process_work_item(self, patch):
     
    173173
    174174    def should_proceed_with_work_item(self, patch):
    175         return (True, "Checking style for patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
     175        return (True, "Checking style for patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
    176176
    177177    def process_work_item(self, patch):
     
    194194        except ScriptError, e:
    195195            return (False, "Unable to perform a build.", None)
    196         return (True, "Building patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
     196        return (True, "Building patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
    197197
    198198    def process_work_item(self, patch):
  • trunk/WebKitTools/Scripts/modules/statusbot.py

    r51018 r51264  
    4747    exit(1)
    4848
     49import urllib2
     50
     51
    4952class StatusBot:
    5053    default_host = "webkit-commit-queue.appspot.com"
     
    5356        self.statusbot_host = host
    5457        self.statusbot_server_url = "http://%s" % self.statusbot_host
    55         self.update_status_url = "%s/update_status" % self.statusbot_server_url
    5658        self.browser = Browser()
    5759
    58     def update_status(self, status, bug_id=None, patch_id=None):
     60    def update_status(self, queue_name, status, patch):
    5961        # During unit testing, statusbot_host is None
    6062        if not self.statusbot_host:
    6163            return
    62         self.browser.open(self.update_status_url)
     64
     65        update_status_url = "%s/update-status" % self.statusbot_server_url
     66        self.browser.open(update_status_url)
    6367        self.browser.select_form(name="update_status")
    64         if bug_id:
    65             self.browser['bug_id'] = str(bug_id)
    66         if patch_id:
    67             self.browser['patch_id'] = str(patch_id)
     68        self.browser['queue_name'] = queue_name
     69        if patch:
     70            if patch.get('bug_id'):
     71                self.browser['bug_id'] = str(patch['bug_id'])
     72            if patch.get('id'):
     73                self.browser['patch_id'] = str(patch['id'])
    6874        self.browser['status'] = status
    6975        self.browser.submit()
     76
     77    def patch_status(self, queue_name, patch_id):
     78        update_status_url = "%s/patch-status/%s/%s" % (self.statusbot_server_url, queue_name, patch_id)
     79        try:
     80            return urllib2.urlopen(update_status_url).read()
     81        except urllib2.HTTPError, e:
     82            if e.code == 404:
     83                return None
     84            raise e
  • trunk/WebKitTools/Scripts/modules/workqueue.py

    r51031 r51264  
    3939
    4040class WorkQueueDelegate:
     41    def queue_name(self):
     42        raise NotImplementedError, "subclasses must implement"
     43
    4144    def queue_log_path(self):
    4245        raise NotImplementedError, "subclasses must implement"
     
    5861
    5962    def should_proceed_with_work_item(self, work_item):
    60         # returns (safe_to_proceed, waiting_message, bug_id)
     63        # returns (safe_to_proceed, waiting_message, patch)
    6164        raise NotImplementedError, "subclasses must implement"
    6265
     
    6972
    7073class WorkQueue:
    71     def __init__(self, delegate):
     74    def __init__(self, name, delegate):
     75        self._name = name
    7276        self._delegate = delegate
    7377        self._output_tee = OutputTee()
     
    96100                    self._update_status_and_sleep("Empty queue.")
    97101                    continue
    98                 (safe_to_proceed, waiting_message, bug_id) = self._delegate.should_proceed_with_work_item(work_item)
     102                (safe_to_proceed, waiting_message, patch) = self._delegate.should_proceed_with_work_item(work_item)
    99103                if not safe_to_proceed:
    100104                    self._update_status_and_sleep(waiting_message)
    101105                    continue
    102                 self.status_bot.update_status(waiting_message, bug_id=bug_id)
     106                self.status_bot.update_status(self._name, waiting_message, patch)
    103107            except Exception, e:
    104108                # Don't try tell the status bot, in case telling it causes an exception.
Note: See TracChangeset for help on using the changeset viewer.