diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/QueueStatusServer | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/QueueStatusServer')
51 files changed, 0 insertions, 2453 deletions
diff --git a/WebKitTools/QueueStatusServer/__init__.py b/WebKitTools/QueueStatusServer/__init__.py deleted file mode 100644 index 2346c23..0000000 --- a/WebKitTools/QueueStatusServer/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# Required for Python to search this directory for module files - -# This __init__.py makes unit testing easier by allowing us to treat the entire server as one big module. -# This file is only accessed when not on AppEngine itself. - -# Make sure that this module will load in that case by including paths to -# the default Google AppEngine install. - - -def fix_sys_path(): - import sys - import os - - # AppEngine imports a bunch of google-specific modules. Thankfully the dev_appserver - # knows how to do the same. Re-use the dev_appserver fix_sys_path logic to import - # all the google.appengine.* stuff so we can run under test-webkitpy - sys.path.append("/usr/local/google_appengine") - import dev_appserver - dev_appserver.fix_sys_path() - - # test-webkitpy adds $WEBKIT/WebKitTools to the sys.path and imports - # QueueStatusServer to run all the tests. However, when AppEngine runs - # our code QueueStatusServer is the root (and thus in the path). - # Emulate that here for test-webkitpy so that we can import "model." - # not "QueueStatusServer.model.", etc. - sys.path.append(os.path.dirname(__file__)) - - -fix_sys_path() diff --git a/WebKitTools/QueueStatusServer/app.yaml b/WebKitTools/QueueStatusServer/app.yaml deleted file mode 100644 index e320eb0..0000000 --- a/WebKitTools/QueueStatusServer/app.yaml +++ /dev/null @@ -1,15 +0,0 @@ -application: webkit-commit-queue -version: 1 -runtime: python -api_version: 1 - -builtins: -- datastore_admin: on -- remote_api: on - -handlers: -- url: /stylesheets - static_dir: stylesheets - -- url: /.* - script: main.py diff --git a/WebKitTools/QueueStatusServer/cron.yaml b/WebKitTools/QueueStatusServer/cron.yaml deleted file mode 100644 index 09b9945..0000000 --- a/WebKitTools/QueueStatusServer/cron.yaml +++ /dev/null @@ -1,4 +0,0 @@ -cron: -- description: collect the garbage - url: /gc - schedule: every 4 hours diff --git a/WebKitTools/QueueStatusServer/filters/__init__.py b/WebKitTools/QueueStatusServer/filters/__init__.py deleted file mode 100644 index ef65bee..0000000 --- a/WebKitTools/QueueStatusServer/filters/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Required for Python to search this directory for module files diff --git a/WebKitTools/QueueStatusServer/filters/webkit_extras.py b/WebKitTools/QueueStatusServer/filters/webkit_extras.py deleted file mode 100644 index b645f78..0000000 --- a/WebKitTools/QueueStatusServer/filters/webkit_extras.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import re - -from django.template.defaultfilters import stringfilter -from google.appengine.ext import webapp - -register = webapp.template.create_template_register() - -bug_regexp = re.compile(r"bug (?P<bug_id>\d+)") -patch_regexp = re.compile(r"patch (?P<patch_id>\d+)") - -@register.filter -@stringfilter -def webkit_linkify(value): - value = bug_regexp.sub(r'<a href="http://webkit.org/b/\g<bug_id>">bug \g<bug_id></a>', value) - value = patch_regexp.sub(r'<a href="https://bugs.webkit.org/attachment.cgi?id=\g<patch_id>&action=prettypatch">patch \g<patch_id></a>', value) - return value - -@register.filter -@stringfilter -def webkit_bug_id(value): - return '<a href="http://webkit.org/b/%s">%s</a>' % (value, value) - -@register.filter -@stringfilter -def webkit_attachment_id(value): - return '<a href="https://bugs.webkit.org/attachment.cgi?id=%s&action=prettypatch">%s</a>' % (value, value) - -@register.filter -@stringfilter -def results_link(status_id): - return '<a href="/results/%s">results</a>' % status_id diff --git a/WebKitTools/QueueStatusServer/handlers/__init__.py b/WebKitTools/QueueStatusServer/handlers/__init__.py deleted file mode 100644 index 296e173..0000000 --- a/WebKitTools/QueueStatusServer/handlers/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Required for Python to search this directory for module files - -from handlers.updatebase import UpdateBase diff --git a/WebKitTools/QueueStatusServer/handlers/dashboard.py b/WebKitTools/QueueStatusServer/handlers/dashboard.py deleted file mode 100644 index 660c595..0000000 --- a/WebKitTools/QueueStatusServer/handlers/dashboard.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import operator - -from google.appengine.ext import webapp -from google.appengine.ext.webapp import template - -from model.attachment import Attachment -from model.queues import Queue - - -class Dashboard(webapp.RequestHandler): - # We may want to sort these? - _ordered_queues = Queue.all() - _header_names = [queue.short_name() for queue in _ordered_queues] - - def _build_bubble(self, attachment, queue): - queue_status = attachment.status_for_queue(queue) - bubble = { - "status_class": attachment.state_from_queue_status(queue_status) if queue_status else "none", - "status_date": queue_status.date if queue_status else None, - } - return bubble - - def _build_row(self, attachment): - row = { - "bug_id": attachment.bug_id(), - "attachment_id": attachment.id, - "bubbles": [self._build_bubble(attachment, queue) for queue in self._ordered_queues], - } - return row - - def get(self): - template_values = { - "headers": self._header_names, - "rows": [self._build_row(attachment) for attachment in Attachment.recent(limit=25)], - } - self.response.out.write(template.render("templates/dashboard.html", template_values)) diff --git a/WebKitTools/QueueStatusServer/handlers/gc.py b/WebKitTools/QueueStatusServer/handlers/gc.py deleted file mode 100644 index d04ee4d..0000000 --- a/WebKitTools/QueueStatusServer/handlers/gc.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp - -from model.queuestatus import QueueStatus - - -class GC(webapp.RequestHandler): - def get(self): - statuses = QueueStatus.all().order("-date") - seen_queues = set() - for status in statuses: - if status.active_patch_id or status.active_bug_id: - continue - if status.queue_name in seen_queues: - status.delete() - seen_queues.add(status.queue_name) - self.response.out.write("Done!") diff --git a/WebKitTools/QueueStatusServer/handlers/nextpatch.py b/WebKitTools/QueueStatusServer/handlers/nextpatch.py deleted file mode 100644 index 5f6d71d..0000000 --- a/WebKitTools/QueueStatusServer/handlers/nextpatch.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from datetime import datetime - -from google.appengine.ext import db -from google.appengine.ext import webapp - -from model.queues import Queue - - -class NextPatch(webapp.RequestHandler): - # FIXME: This should probably be a post, or an explict lock_patch - # since GET requests shouldn't really modify the datastore. - def get(self, queue_name): - queue = Queue.queue_with_name(queue_name) - if not queue: - self.error(404) - return - # FIXME: Patch assignment should probably move into Queue. - patch_id = db.run_in_transaction(self._assign_patch, queue.active_work_items().key(), queue.work_items().item_ids) - if not patch_id: - self.error(404) - return - self.response.out.write(patch_id) - - @staticmethod - def _assign_patch(key, work_item_ids): - now = datetime.now() - active_work_items = db.get(key) - active_work_items.deactivate_expired(now) - next_item = active_work_items.next_item(work_item_ids, now) - active_work_items.put() - return next_item diff --git a/WebKitTools/QueueStatusServer/handlers/patch.py b/WebKitTools/QueueStatusServer/handlers/patch.py deleted file mode 100644 index 3219212..0000000 --- a/WebKitTools/QueueStatusServer/handlers/patch.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp -from google.appengine.ext.webapp import template - -from model.queuestatus import QueueStatus - - -class Patch(webapp.RequestHandler): - def get(self, attachment_id_string): - attachment_id = int(attachment_id_string) - statuses = QueueStatus.all().filter("active_patch_id =", attachment_id).order("-date") - - bug_id = None - queue_status = {} - for status in statuses: - bug_id = status.active_bug_id # Should be the same for every status. - per_queue_statuses = queue_status.get(status.queue_name, []) - per_queue_statuses.append(status) - queue_status[status.queue_name] = per_queue_statuses - - template_values = { - "attachment_id" : attachment_id, - "bug_id" : bug_id, - "queue_status" : queue_status, - } - self.response.out.write(template.render("templates/patch.html", template_values)) diff --git a/WebKitTools/QueueStatusServer/handlers/patchstatus.py b/WebKitTools/QueueStatusServer/handlers/patchstatus.py deleted file mode 100644 index 1a5422e..0000000 --- a/WebKitTools/QueueStatusServer/handlers/patchstatus.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp - -from model.queuestatus import QueueStatus - - -class PatchStatus(webapp.RequestHandler): - def get(self, queue_name, attachment_id): - statuses = QueueStatus.all().filter('queue_name =', queue_name).filter('active_patch_id =', int(attachment_id)).order('-date').fetch(1) - if not statuses: - self.error(404) - return - self.response.out.write(statuses[0].message) diff --git a/WebKitTools/QueueStatusServer/handlers/queuestatus.py b/WebKitTools/QueueStatusServer/handlers/queuestatus.py deleted file mode 100644 index 54c0fdd..0000000 --- a/WebKitTools/QueueStatusServer/handlers/queuestatus.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import itertools - -from google.appengine.ext import webapp -from google.appengine.ext.webapp import template - -from model.queues import Queue -from model import queuestatus - - -class QueueStatus(webapp.RequestHandler): - def _rows_for_work_items(self, queue): - queued_items = queue.work_items() - active_items = queue.active_work_items() - if not queued_items: - return [] - rows = [] - for item_id in queued_items.item_ids: - rows.append({ - "attachment_id": item_id, - "bug_id": 1, - "lock_time": active_items and active_items.time_for_item(item_id), - }) - return rows - - def _grouping_key_for_status(self, status): - return "%s-%s" % (status.active_patch_id, status.bot_id) - - def _build_status_groups(self, statuses): - return [list(group) for key, group in itertools.groupby(statuses, self._grouping_key_for_status)] - - def get(self, queue_name): - queue_name = queue_name.lower() - queue = Queue.queue_with_name(queue_name) - if not queue: - self.error(404) - return - - statuses = queuestatus.QueueStatus.all().filter("queue_name =", queue.name()).order("-date").fetch(15) - template_values = { - "display_queue_name": queue.display_name(), - "work_item_rows": self._rows_for_work_items(queue), - "status_groups": self._build_status_groups(statuses), - } - self.response.out.write(template.render("templates/queuestatus.html", template_values)) diff --git a/WebKitTools/QueueStatusServer/handlers/queuestatus_unittest.py b/WebKitTools/QueueStatusServer/handlers/queuestatus_unittest.py deleted file mode 100644 index a5ae844..0000000 --- a/WebKitTools/QueueStatusServer/handlers/queuestatus_unittest.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - -from handlers.queuestatus import QueueStatus -from model.queues import Queue - - -class MockStatus(object): - def __init__(self, patch_id, bot_id): - self.active_patch_id = patch_id - self.bot_id = bot_id - - -class QueueStatusTest(unittest.TestCase): - def test_build_status_groups(self): - queue_status = QueueStatus() - statuses = [ - MockStatus(1, "foo"), - MockStatus(1, "foo"), - MockStatus(2, "foo"), - MockStatus(1, "foo"), - MockStatus(1, "bar"), - MockStatus(1, "foo"), - ] - groups = queue_status._build_status_groups(statuses) - self.assertEqual(len(groups), 5) - self.assertEqual(groups[0], statuses[0:2]) - self.assertEqual(groups[1], statuses[2:3]) - self.assertEqual(groups[2], statuses[3:4]) - self.assertEqual(groups[3], statuses[4:5]) - self.assertEqual(groups[4], statuses[5:6]) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/handlers/recentstatus.py b/WebKitTools/QueueStatusServer/handlers/recentstatus.py deleted file mode 100644 index fddc93a..0000000 --- a/WebKitTools/QueueStatusServer/handlers/recentstatus.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import datetime - -from google.appengine.ext import webapp -from google.appengine.ext.webapp import template - -from model.queues import Queue -from model.queuestatus import QueueStatus -from model.workitems import WorkItems - - -class QueueBubble(object): - """View support class for recentstatus.html""" - def __init__(self, queue): - self._queue = queue - self._work_items = queue.work_items() - self._last_status = QueueStatus.all().filter("queue_name =", queue.name()).order("-date").get() - - # FIXME: name and display_name should be replaced by a .queue() accessor. - def name(self): - return self._queue.name() - - def display_name(self): - return self._queue.display_name() - - def _last_status_date(self): - if not self._last_status: - return None - return self._last_status.date - - def last_heard_from(self): - if not self._work_items: - return self._last_status_date() - return max(self._last_status_date(), self._work_items.date) - - def is_alive(self): - if not self.last_heard_from(): - return False - return self.last_heard_from() > (datetime.datetime.now() - datetime.timedelta(minutes=30)) - - def status_class(self): - if not self.is_alive(): - return "dead" - if self.pending_items_count() > 1: - return "behind" - return "alive" - - def status_text(self): - if not self._work_items: - return "Offline" - if not self._work_items.item_ids: - return "Idle" - return self._last_status.message - - def pending_items_count(self): - if not self._work_items: - return 0 - return len(self._work_items.item_ids) - - -class QueuesOverview(webapp.RequestHandler): - - def get(self): - template_values = { - "queues": [QueueBubble(queue) for queue in Queue.all()], - } - self.response.out.write(template.render("templates/recentstatus.html", template_values)) diff --git a/WebKitTools/QueueStatusServer/handlers/releasepatch.py b/WebKitTools/QueueStatusServer/handlers/releasepatch.py deleted file mode 100644 index 0e46e69..0000000 --- a/WebKitTools/QueueStatusServer/handlers/releasepatch.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp, db -from google.appengine.ext.webapp import template - -from handlers.updatebase import UpdateBase -from model.attachment import Attachment -from model.queues import Queue - - -class ReleasePatch(UpdateBase): - def get(self): - self.response.out.write(template.render("templates/releasepatch.html", None)) - - def post(self): - queue_name = self.request.get("queue_name") - # FIXME: This queue lookup should be shared between handlers. - queue = Queue.queue_with_name(queue_name) - if not queue: - self.error(404) - return - - attachment_id = self._int_from_request("attachment_id") - attachment = Attachment(attachment_id) - last_status = attachment.status_for_queue(queue) - - # Ideally we should use a transaction for the calls to - # WorkItems and ActiveWorkItems. - - # Only remove it from the queue if the last message is not a retry request. - # Allow removing it from the queue even if there is no last_status for easier testing. - if not last_status or not last_status.is_retry_request(): - queue.work_items().remove_work_item(attachment_id) - - # Always release the lock on the item. - queue.active_work_items().expire_item(attachment_id) diff --git a/WebKitTools/QueueStatusServer/handlers/showresults.py b/WebKitTools/QueueStatusServer/handlers/showresults.py deleted file mode 100644 index e4cb71b..0000000 --- a/WebKitTools/QueueStatusServer/handlers/showresults.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp - -from model.queuestatus import QueueStatus - - -class ShowResults(webapp.RequestHandler): - def get(self, status_id): - status = QueueStatus.get_by_id(int(status_id)) - if not status: - self.error(404) - return - self.response.headers["Content-Type"] = "text/plain; charset=utf-8" - self.response.out.write(status.results_file) diff --git a/WebKitTools/QueueStatusServer/handlers/statusbubble.py b/WebKitTools/QueueStatusServer/handlers/statusbubble.py deleted file mode 100644 index 5690484..0000000 --- a/WebKitTools/QueueStatusServer/handlers/statusbubble.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import operator - -from google.appengine.ext import webapp -from google.appengine.ext.webapp import template - -from model.attachment import Attachment -from model.workitems import WorkItems -from model.queues import Queue - - -class StatusBubble(webapp.RequestHandler): - _queues_to_display = [queue for queue in Queue.all() if queue.is_ews()] - - def _build_bubble(self, queue, attachment): - queue_status = attachment.status_for_queue(queue) - bubble = { - "name": queue.short_name().lower(), - "attachment_id": attachment.id, - "queue_position": attachment.position_in_queue(queue), - "state": attachment.state_from_queue_status(queue_status) if queue_status else "none", - "status": queue_status, - } - return bubble - - def get(self, attachment_id): - attachment = Attachment(int(attachment_id)) - bubbles = [self._build_bubble(queue, attachment) for queue in self._queues_to_display] - template_values = { - "bubbles": bubbles, - } - self.response.out.write(template.render("templates/statusbubble.html", template_values)) diff --git a/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py b/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py deleted file mode 100644 index 3ffbdaf..0000000 --- a/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - - -from handlers.statusbubble import StatusBubble -from model.queues import Queue - - -class MockAttachment(object): - def __init__(self): - self.id = 1 - - def status_for_queue(self, queue): - return None - - def position_in_queue(self, queue): - return 1 - - -class StatusBubbleTest(unittest.TestCase): - def test_build_bubble(self): - bubble = StatusBubble() - queue = Queue("mac-ews") - attachment = MockAttachment() - bubble_dict = bubble._build_bubble(queue, attachment) - # FIXME: assertDictEqual (in Python 2.7) would be better to use here. - self.assertEqual(bubble_dict["name"], "mac") - self.assertEqual(bubble_dict["attachment_id"], 1) - self.assertEqual(bubble_dict["queue_position"], 1) - self.assertEqual(bubble_dict["state"], "none") - self.assertEqual(bubble_dict["status"], None) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/handlers/submittoews.py b/WebKitTools/QueueStatusServer/handlers/submittoews.py deleted file mode 100644 index 3ba4373..0000000 --- a/WebKitTools/QueueStatusServer/handlers/submittoews.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp, db -from google.appengine.ext.webapp import template - -from handlers.updatebase import UpdateBase -from model.attachment import Attachment -from model.queues import Queue - - -class SubmitToEWS(UpdateBase): - def get(self): - self.response.out.write(template.render("templates/submittoews.html", None)) - - def _should_add_to_ews_queue(self, queue, attachment): - # This assert() is here to make sure we're not submitting to the commit-queue. - # The commit-queue clients check each patch anyway, but there is not sense - # in adding things to the commit-queue when they won't be processed by it. - assert(queue.is_ews()) - latest_status = attachment.status_for_queue(queue) - if not latest_status: - return True - # Only ever re-submit to the EWS if the EWS specifically requested a retry. - # This allows us to restart the EWS feeder queue, without all r? patches - # being retried as a result of that restart! - # In some future version we might add a "force" button to allow the user - # to override this restriction. - return latest_status.is_retry_request() - - def _add_attachment_to_ews_queues(self, attachment): - for queue in Queue.all_ews(): # all_ews() currently includes the style-queue - if self._should_add_to_ews_queue(queue, attachment): - queue.work_items().add_work_item(attachment.id) - - def post(self): - attachment_id = self._int_from_request("attachment_id") - attachment = Attachment(attachment_id) - self._add_attachment_to_ews_queues(attachment) diff --git a/WebKitTools/QueueStatusServer/handlers/svnrevision.py b/WebKitTools/QueueStatusServer/handlers/svnrevision.py deleted file mode 100644 index 36eab33..0000000 --- a/WebKitTools/QueueStatusServer/handlers/svnrevision.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp - -import model - - -class SVNRevision(webapp.RequestHandler): - def get(self, svn_revision_number): - svn_revisions = model.SVNRevision.all().filter('number =', int(svn_revision_number)).order('-date').fetch(1) - if not svn_revisions: - self.error(404) - return - self.response.out.write(svn_revisions[0].to_xml()) diff --git a/WebKitTools/QueueStatusServer/handlers/updatebase.py b/WebKitTools/QueueStatusServer/handlers/updatebase.py deleted file mode 100644 index b087e83..0000000 --- a/WebKitTools/QueueStatusServer/handlers/updatebase.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.api import users -from google.appengine.ext import webapp, db - - -class UpdateBase(webapp.RequestHandler): - def _int_from_request(self, name): - string_value = self.request.get(name) - try: - int_value = int(string_value) - return int_value - except ValueError, TypeError: - pass - return None diff --git a/WebKitTools/QueueStatusServer/handlers/updatestatus.py b/WebKitTools/QueueStatusServer/handlers/updatestatus.py deleted file mode 100644 index 7301101..0000000 --- a/WebKitTools/QueueStatusServer/handlers/updatestatus.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.api import users -from google.appengine.ext import webapp, db -from google.appengine.ext.webapp import template - -from handlers.updatebase import UpdateBase -from model.attachment import Attachment -from model.queuestatus import QueueStatus - - -class UpdateStatus(UpdateBase): - def get(self): - self.response.out.write(template.render("templates/updatestatus.html", None)) - - def _queue_status_from_request(self): - queue_status = QueueStatus() - - # FIXME: I think this can be removed, no one uses it. - if users.get_current_user(): - queue_status.author = users.get_current_user() - - bug_id = self._int_from_request("bug_id") - patch_id = self._int_from_request("patch_id") - queue_name = self.request.get("queue_name") - bot_id = self.request.get("bot_id") - queue_status.queue_name = queue_name - queue_status.bot_id = bot_id - queue_status.active_bug_id = bug_id - queue_status.active_patch_id = patch_id - queue_status.message = self.request.get("status") - results_file = self.request.get("results_file") - queue_status.results_file = db.Blob(str(results_file)) - return queue_status - - def post(self): - queue_status = self._queue_status_from_request() - queue_status.put() - Attachment.dirty(queue_status.active_patch_id) - self.response.out.write(queue_status.key().id()) diff --git a/WebKitTools/QueueStatusServer/handlers/updatesvnrevision.py b/WebKitTools/QueueStatusServer/handlers/updatesvnrevision.py deleted file mode 100644 index 075982a..0000000 --- a/WebKitTools/QueueStatusServer/handlers/updatesvnrevision.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp, db -from google.appengine.ext.webapp import template - -import handlers -import model - - -class UpdateSVNRevision(handlers.UpdateBase): - def get(self): - self.response.out.write(template.render("templates/updatesvnrevision.html", None)) - - def post(self): - svn_revision_number = self._int_from_request("number") - - svn_revisions = model.SVNRevision.all().filter('number =', svn_revision_number).order('-date').fetch(1) - svn_revision = None - if svn_revisions: - svn_revision = svn_revisions[0] - else: - svn_revision = model.SVNRevision() - svn_revision.number = svn_revision_number - svn_revision.broken_bots.append(self.request.get("broken_bot")) - svn_revision.put() - - self.response.out.write(svn_revision.key().id()) diff --git a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py b/WebKitTools/QueueStatusServer/handlers/updateworkitems.py deleted file mode 100644 index 16a9d49..0000000 --- a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import webapp, db -from google.appengine.ext.webapp import template - -from handlers.updatebase import UpdateBase -from model.queues import Queue -from model.workitems import WorkItems - -from datetime import datetime - - -class UpdateWorkItems(UpdateBase): - def get(self): - self.response.out.write(template.render("templates/updateworkitems.html", None)) - - def _parse_work_items_string(self, items_string): - # Our parsing could be much more robust. - item_strings = items_string.split(" ") if items_string else [] - return map(int, item_strings) - - def _work_items_from_request(self): - queue_name = self.request.get("queue_name") - queue = Queue.queue_with_name(queue_name) - if not queue: - self.response.out.write("\"%s\" is not in queues %s" % (queue_name, Queue.all())) - return None - - items_string = self.request.get("work_items") - work_items = queue.work_items() - work_items.item_ids = self._parse_work_items_string(items_string) - work_items.date = datetime.now() - return work_items - - def post(self): - work_items = self._work_items_from_request() - if not work_items: - self.response.set_status(500) - return - work_items.put() diff --git a/WebKitTools/QueueStatusServer/index.yaml b/WebKitTools/QueueStatusServer/index.yaml deleted file mode 100644 index 6c9a3b2..0000000 --- a/WebKitTools/QueueStatusServer/index.yaml +++ /dev/null @@ -1,41 +0,0 @@ -indexes: - -# AUTOGENERATED - -# This index.yaml is automatically updated whenever the dev_appserver -# detects that a new type of query is run. If you want to manage the -# index.yaml file manually, remove the above marker line (the line -# saying "# AUTOGENERATED"). If you want to manage some indexes -# manually, move them above the marker line. The index.yaml file is -# automatically uploaded to the admin console when you next deploy -# your application using appcfg.py. - -- kind: QueueStatus - properties: - - name: active_patch_id - - name: date - direction: desc - -- kind: QueueStatus - properties: - - name: active_patch_id - - name: queue_name - - name: date - direction: desc - -- kind: QueueStatus - properties: - - name: queue_name - - name: date - -- kind: QueueStatus - properties: - - name: queue_name - - name: date - direction: desc - -- kind: SVNRevision - properties: - - name: number - - name: date - direction: desc diff --git a/WebKitTools/QueueStatusServer/main.py b/WebKitTools/QueueStatusServer/main.py deleted file mode 100644 index 3fbee5c..0000000 --- a/WebKitTools/QueueStatusServer/main.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Request a modern Django -from google.appengine.dist import use_library -use_library('django', '1.1') - -from google.appengine.ext import webapp -from google.appengine.ext.webapp.util import run_wsgi_app - -from handlers.dashboard import Dashboard -from handlers.gc import GC -from handlers.nextpatch import NextPatch -from handlers.patch import Patch -from handlers.patchstatus import PatchStatus -from handlers.queuestatus import QueueStatus -from handlers.recentstatus import QueuesOverview -from handlers.releasepatch import ReleasePatch -from handlers.showresults import ShowResults -from handlers.statusbubble import StatusBubble -from handlers.submittoews import SubmitToEWS -from handlers.svnrevision import SVNRevision -from handlers.updatestatus import UpdateStatus -from handlers.updatesvnrevision import UpdateSVNRevision -from handlers.updateworkitems import UpdateWorkItems - - -webapp.template.register_template_library('filters.webkit_extras') - -routes = [ - ('/', QueuesOverview), - ('/dashboard', Dashboard), - ('/gc', GC), - (r'/patch-status/(.*)/(.*)', PatchStatus), - (r'/patch/(.*)', Patch), - (r'/submit-to-ews', SubmitToEWS), - (r'/results/(.*)', ShowResults), - (r'/status-bubble/(.*)', StatusBubble), - (r'/svn-revision/(.*)', SVNRevision), - (r'/queue-status/(.*)', QueueStatus), - (r'/next-patch/(.*)', NextPatch), - (r'/release-patch', ReleasePatch), - ('/update-status', UpdateStatus), - ('/update-work-items', UpdateWorkItems), - ('/update-svn-revision', UpdateSVNRevision), -] - -application = webapp.WSGIApplication(routes, debug=True) - -def main(): - run_wsgi_app(application) - -if __name__ == "__main__": - main() diff --git a/WebKitTools/QueueStatusServer/model/__init__.py b/WebKitTools/QueueStatusServer/model/__init__.py deleted file mode 100644 index 1eaa044..0000000 --- a/WebKitTools/QueueStatusServer/model/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Required for Python to search this directory for module files - -from model.svnrevision import SVNRevision diff --git a/WebKitTools/QueueStatusServer/model/activeworkitems.py b/WebKitTools/QueueStatusServer/model/activeworkitems.py deleted file mode 100644 index ab5d7a6..0000000 --- a/WebKitTools/QueueStatusServer/model/activeworkitems.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import db - -from datetime import timedelta, datetime -import time - -from model.queuepropertymixin import QueuePropertyMixin - - -class ActiveWorkItems(db.Model, QueuePropertyMixin): - queue_name = db.StringProperty() - item_ids = db.ListProperty(int) - item_dates = db.ListProperty(float) - date = db.DateTimeProperty(auto_now_add=True) - - # The id/date pairs should probably just be their own class. - def _item_time_pairs(self): - return zip(self.item_ids, self.item_dates) - - def _set_item_time_pairs(self, pairs): - if pairs: - # The * operator raises on an empty list. - # db.Model does not tuples, we have to make lists. - self.item_ids, self.item_dates = map(list, zip(*pairs)) - else: - self.item_ids = [] - self.item_dates = [] - - def _append_item_time_pair(self, pair): - self.item_ids.append(pair[0]) - self.item_dates.append(pair[1]) - - def _remove_item(self, item_id): - nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[0] != item_id] - self._set_item_time_pairs(nonexpired_pairs) - - @staticmethod - def _expire_item(key, item_id): - active_work_items = db.get(key) - active_work_items._remove_item(item_id) - active_work_items.put() - - def expire_item(self, item_id): - return db.run_in_transaction(self._expire_item, self.key(), item_id) - - def deactivate_expired(self, now): - one_hour_ago = time.mktime((now - timedelta(minutes=60)).timetuple()) - nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[1] > one_hour_ago] - self._set_item_time_pairs(nonexpired_pairs) - - def next_item(self, work_item_ids, now): - for item_id in work_item_ids: - if item_id not in self.item_ids: - self._append_item_time_pair([item_id, time.mktime(now.timetuple())]) - return item_id - return None - - def time_for_item(self, item_id): - for active_item_id, time in self._item_time_pairs(): - if active_item_id == item_id: - return datetime.fromtimestamp(time) - return None diff --git a/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py b/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py deleted file mode 100644 index 6d915a1..0000000 --- a/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest -from datetime import datetime - -from model.activeworkitems import ActiveWorkItems - - -class ActiveWorkItemsTest(unittest.TestCase): - def test_basic(self): - items = ActiveWorkItems() - queued_items = [1, 2] - time = datetime.now() - self.assertEqual(items.next_item(queued_items, time), 1) - self.assertEqual(items.next_item([1], time), None) - self.assertEqual(items.next_item([], time), None) - - self.assertEqual(items.time_for_item(1), time) - self.assertEqual(items.time_for_item(2), None) - - items.expire_item(1) - self.assertEqual(items.time_for_item(1), None) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/model/attachment.py b/WebKitTools/QueueStatusServer/model/attachment.py deleted file mode 100644 index f98f265..0000000 --- a/WebKitTools/QueueStatusServer/model/attachment.py +++ /dev/null @@ -1,133 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import re - -from google.appengine.api import memcache - -from model.queues import Queue -from model.queuestatus import QueueStatus -from model.workitems import WorkItems - - -class Attachment(object): - @classmethod - def dirty(cls, attachment_id): - memcache.delete(str(attachment_id), namespace="attachment-summary") - - @classmethod - def recent(cls, limit=1): - statuses = QueueStatus.all().order("-date") - # Notice that we use both a set and a list here to keep the -date ordering. - ids = [] - visited_ids = set() - for status in statuses: - attachment_id = status.active_patch_id - if not attachment_id: - continue - if attachment_id in visited_ids: - continue - visited_ids.add(attachment_id) - ids.append(attachment_id) - if len(visited_ids) >= limit: - break - return map(cls, ids) - - def __init__(self, attachment_id): - self.id = attachment_id - self._summary = None - self._cached_queue_positions = None - - def summary(self): - if self._summary: - return self._summary - self._summary = memcache.get(str(self.id), namespace="attachment-summary") - if self._summary: - return self._summary - self._summary = self._fetch_summary() - memcache.set(str(self.id), self._summary, namespace="attachment-summary") - return self._summary - - def state_from_queue_status(self, status): - table = { - "Pass" : "pass", - "Fail" : "fail", - } - state = table.get(status.message) - if state: - return state - if status.message.startswith("Error:"): - return "error" - if status: - return "pending" - return None - - def position_in_queue(self, queue): - return self._queue_positions().get(queue.name()) - - def status_for_queue(self, queue): - # summary() is a horrible API and should be killed. - queue_summary = self.summary().get(queue.name_with_underscores()) - if not queue_summary: - return None - return queue_summary.get("status") - - def bug_id(self): - return self.summary().get("bug_id") - - def _queue_positions(self): - if self._cached_queue_positions: - return self._cached_queue_positions - # FIXME: Should we be mem-caching this? - self._cached_queue_positions = self._calculate_queue_positions() - return self._cached_queue_positions - - def _calculate_queue_positions(self): - all_work_items = WorkItems.all().fetch(limit=len(Queue.all())) - return dict([(items.queue.name(), items.display_position_for_attachment(self.id)) for items in all_work_items]) - - # FIXME: This is controller/view code and does not belong in a model. - def _fetch_summary(self): - summary = { "attachment_id" : self.id } - - first_status = QueueStatus.all().filter('active_patch_id =', self.id).get() - if not first_status: - # We don't have any record of this attachment. - return summary - summary["bug_id"] = first_status.active_bug_id - - for queue in Queue.all(): - summary[queue.name_with_underscores()] = None - status = QueueStatus.all().filter('queue_name =', queue.name()).filter('active_patch_id =', self.id).order('-date').get() - if status: - # summary() is a horrible API and should be killed. - summary[queue.name_with_underscores()] = { - "state": self.state_from_queue_status(status), - "status": status, - } - return summary diff --git a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py b/WebKitTools/QueueStatusServer/model/queuepropertymixin.py deleted file mode 100644 index a462586..0000000 --- a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -class QueuePropertyMixin(object): - def _queue_getter(self): - # Import at runtime to avoid circular imports - from model.queues import Queue - return Queue.queue_with_name(self.queue_name) - - def _queue_setter(self, queue): - self.queue_name = queue.name() if queue else None - - queue = property(_queue_getter, _queue_setter) diff --git a/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py b/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py deleted file mode 100644 index 9a301fe..0000000 --- a/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - -from model.queuepropertymixin import QueuePropertyMixin -from model.queues import Queue - - -class ObjectWithQueueName(QueuePropertyMixin): - def __init__(self): - self.queue_name = None - - -class QueuePropertyMixinTest(unittest.TestCase): - def test_queue_property(self): - test_object = ObjectWithQueueName() - mac_ews = Queue("mac-ews") - test_object.queue = mac_ews - self.assertEquals(test_object.queue.name(), "mac-ews") - self.assertEquals(test_object.queue_name, "mac-ews") - test_object.queue = None - self.assertEquals(test_object.queue_name, None) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/model/queues.py b/WebKitTools/QueueStatusServer/model/queues.py deleted file mode 100644 index 1d46f89..0000000 --- a/WebKitTools/QueueStatusServer/model/queues.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import re - -from model.activeworkitems import ActiveWorkItems -from model.workitems import WorkItems - - -class Queue(object): - - # Eventually the list of queues may be stored in the data store. - _all_queue_names = [ - "commit-queue", - "style-queue", - "chromium-ews", - "qt-ews", - "gtk-ews", - "mac-ews", - "win-ews", - "efl-ews", - "cr-mac-ews", - ] - - def __init__(self, name): - assert(name in self._all_queue_names) - self._name = name - - @classmethod - def queue_with_name(cls, queue_name): - if queue_name not in cls._all_queue_names: - return None - return Queue(queue_name) - - @classmethod - def all(cls): - return [Queue(name) for name in cls._all_queue_names] - - @classmethod - def all_ews(cls): - return [queue for queue in cls.all() if queue.is_ews()] - - def name(self): - return self._name - - def work_items(self): - key_name = "work-items-%s" % (self._name) - return WorkItems.get_or_insert(key_name=key_name, queue_name=self._name) - - # FIXME: active_work_items is a bad name for this lock-table. - def active_work_items(self): - key_name = "active-work-items-%s" % (self._name) - return ActiveWorkItems.get_or_insert(key_name=key_name, queue_name=self._name) - - def _caplitalize_after_dash(self, string): - return "-".join([word[0].upper() + word[1:] for word in string.split("-")]) - - # For use in status bubbles or table headers - def short_name(self): - # HACK: chromium-ews is incorrectly named. - short_name = self._name.replace("chromium-ews", "Cr-Linux-ews") - short_name = short_name.replace("-ews", "") - short_name = short_name.replace("-queue", "") - return self._caplitalize_after_dash(short_name.capitalize()) - - def display_name(self): - # HACK: chromium-ews is incorrectly named. - display_name = self._name.replace("chromium-ews", "cr-linux-ews") - - display_name = display_name.replace("-", " ") - display_name = display_name.replace("cr", "chromium") - display_name = display_name.title() - display_name = display_name.replace("Ews", "EWS") - return display_name - - _dash_regexp = re.compile("-") - - def name_with_underscores(self): - return self._dash_regexp.sub("_", self._name) - - def is_ews(self): - # Note: The style-queue is just like an EWS in that it has an EWS - # bubble, and it works off of the r? patches. If at some later - # point code wants to not treat the style-queue as an EWS - # (e.g. expecting is_ews() queues to have build results?) - # then we should fix all callers and change this check. - return self._name.endswith("-ews") or self._name == "style-queue" diff --git a/WebKitTools/QueueStatusServer/model/queues_unittest.py b/WebKitTools/QueueStatusServer/model/queues_unittest.py deleted file mode 100644 index cfa7fcd..0000000 --- a/WebKitTools/QueueStatusServer/model/queues_unittest.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - - -from model.queues import Queue - - -class QueueTest(unittest.TestCase): - def test_is_ews(self): - mac_ews = Queue("mac-ews") - self.assertTrue(mac_ews.is_ews()) - - def test_queue_with_name(self): - self.assertEqual(Queue.queue_with_name("bogus"), None) - self.assertEqual(Queue.queue_with_name("mac-ews").name(), "mac-ews") - self.assertRaises(AssertionError, Queue, ("bogus")) - - def _assert_short_name(self, queue_name, short_name): - self.assertEquals(Queue(queue_name).short_name(), short_name) - - def test_short_name(self): - self._assert_short_name("mac-ews", "Mac") - self._assert_short_name("chromium-ews", "Cr-Linux") - self._assert_short_name("commit-queue", "Commit") - self._assert_short_name("style-queue", "Style") - - def _assert_display_name(self, queue_name, short_name): - self.assertEquals(Queue(queue_name).display_name(), short_name) - - def test_display_name(self): - self._assert_display_name("mac-ews", "Mac EWS") - self._assert_display_name("chromium-ews", "Chromium Linux EWS") - self._assert_display_name("commit-queue", "Commit Queue") - self._assert_display_name("style-queue", "Style Queue") - - def _assert_name_with_underscores(self, queue_name, short_name): - self.assertEquals(Queue(queue_name).name_with_underscores(), short_name) - - def test_name_with_underscores(self): - self._assert_name_with_underscores("mac-ews", "mac_ews") - self._assert_name_with_underscores("chromium-ews", "chromium_ews") - self._assert_name_with_underscores("commit-queue", "commit_queue") - - def test_style_queue_is_ews(self): - # For now we treat the style-queue as an EWS since most users would - # describe it as such. If is_ews() ever needs to mean "builds the patch" - # or similar, then we will need to adjust all callers. - self.assertTrue(Queue("style-queue").is_ews()) - self.assertTrue("style-queue" in map(Queue.name, Queue.all_ews())) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/model/queuestatus.py b/WebKitTools/QueueStatusServer/model/queuestatus.py deleted file mode 100644 index 8002f89..0000000 --- a/WebKitTools/QueueStatusServer/model/queuestatus.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import db -from model.queuepropertymixin import QueuePropertyMixin - - -class QueueStatus(db.Model, QueuePropertyMixin): - author = db.UserProperty() - queue_name = db.StringProperty() - bot_id = db.StringProperty() - active_bug_id = db.IntegerProperty() - active_patch_id = db.IntegerProperty() - message = db.StringProperty(multiline=True) - date = db.DateTimeProperty(auto_now_add=True) - results_file = db.BlobProperty() - - def is_retry_request(self): - return self.message == "Retry" # From AbstractQueue._retry_status diff --git a/WebKitTools/QueueStatusServer/model/svnrevision.py b/WebKitTools/QueueStatusServer/model/svnrevision.py deleted file mode 100644 index f5d3644..0000000 --- a/WebKitTools/QueueStatusServer/model/svnrevision.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import db - - -class SVNRevision(db.Model): - number = db.IntegerProperty() - broken_bots = db.StringListProperty(default=[]) - date = db.DateTimeProperty(auto_now_add=True) diff --git a/WebKitTools/QueueStatusServer/model/workitems.py b/WebKitTools/QueueStatusServer/model/workitems.py deleted file mode 100644 index 772fc39..0000000 --- a/WebKitTools/QueueStatusServer/model/workitems.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from google.appengine.ext import db - -from model.queuepropertymixin import QueuePropertyMixin - - -class WorkItems(db.Model, QueuePropertyMixin): - queue_name = db.StringProperty() - item_ids = db.ListProperty(int) - date = db.DateTimeProperty(auto_now_add=True) - - def display_position_for_attachment(self, attachment_id): - """Returns a 1-based index corresponding to the position - of the attachment_id in the queue. If the attachment is - not in this queue, this returns None""" - if attachment_id in self.item_ids: - return self.item_ids.index(attachment_id) + 1 - return None - - @staticmethod - def _unguarded_add(key, attachment_id): - work_items = db.get(key) - if attachment_id in work_items.item_ids: - return - work_items.item_ids.append(attachment_id) - work_items.put() - - # Because this uses .key() self.is_saved() must be True or this will throw NotSavedError. - def add_work_item(self, attachment_id): - db.run_in_transaction(self._unguarded_add, self.key(), attachment_id) - - @staticmethod - def _unguarded_remove(key, attachment_id): - work_items = db.get(key) - if attachment_id in work_items.item_ids: - # We should never have more than one entry for a work item, so we only need remove the first. - work_items.item_ids.remove(attachment_id) - work_items.put() - - # Because this uses .key() self.is_saved() must be True or this will throw NotSavedError. - def remove_work_item(self, attachment_id): - db.run_in_transaction(self._unguarded_remove, self.key(), attachment_id) diff --git a/WebKitTools/QueueStatusServer/model/workitems_unittest.py b/WebKitTools/QueueStatusServer/model/workitems_unittest.py deleted file mode 100644 index b1ff1d3..0000000 --- a/WebKitTools/QueueStatusServer/model/workitems_unittest.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2010 Google, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Research in Motion Ltd. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - - -from model.workitems import WorkItems - - -class WorkItemsTest(unittest.TestCase): - def test_display_position_for_attachment(self): - items = WorkItems() - items.item_ids = [0, 1, 2] - self.assertEquals(items.display_position_for_attachment(0), 1) - self.assertEquals(items.display_position_for_attachment(1), 2) - self.assertEquals(items.display_position_for_attachment(3), None) - - -if __name__ == '__main__': - unittest.main() diff --git a/WebKitTools/QueueStatusServer/stylesheets/dashboard.css b/WebKitTools/QueueStatusServer/stylesheets/dashboard.css deleted file mode 100644 index 7b4f857..0000000 --- a/WebKitTools/QueueStatusServer/stylesheets/dashboard.css +++ /dev/null @@ -1,103 +0,0 @@ -body { - font-family: Verdana, Helvetica, sans-serif; - width: 600px; - padding: 0px; - color: #444; -} -h1 { - background-color: #EEE; - color: #444; - font-size: 14pt; - font-style: italic; - margin: 0px; - padding: 5px; -} -h2 { - background-color: #AAA; - color: white; - font-weight: bold; - font-size: 9pt; - margin: 0px; - padding: 5px; -} -ul { - margin: 0px; - padding: 0px; - list-style: none; -} -li { - padding: 5px; -} -table { - border-spacing: 0px; -} -th { - background-color: #AAA; - color: white; - padding: 5px; - width: 100px; - font-size: 9pt; -} -td { - text-align: center; -} -tr:hover, li:hover { - background-color: #EEE; -} - -.status-group { - font-size: 90%; -} - -.status-bug { - font-weight: bold; -} - -.status-group ul { - font-size: 90%; -} - -.status-group ul li { - padding: 2px 0 2px 7px; - overflow: hidden; -} - -.status-group ul li:hover { - background: #ddd; -} - -.status-date { - color: #AAA; - float: right; - font-size: 8pt; -} - -.status-cell { - margin: 1px; - padding: 1px 2px; - font-size: 9pt; - border: 1px solid transparent; -} -.status-cell:hover { - border: 1px solid black; -} -.status-cell.pass { - background-color: #8FDF5F; - cursor: pointer; - /* border: 1px solid #4F8530; */ -} -.status-cell.fail { - background-color: #E98080; - cursor: pointer; - /* border: 1px solid #A77272; */ -} -.status-cell.pending { - background-color: #FFFC6C; - cursor: pointer; - /* border: 1px solid #C5C56D; */ -} -.status-cell.error { - background-color: #E0B0FF; - cursor: pointer; - /* border: 1px solid #ACA0B3; */ -} diff --git a/WebKitTools/QueueStatusServer/stylesheets/main.css b/WebKitTools/QueueStatusServer/stylesheets/main.css deleted file mode 100644 index 55d3694..0000000 --- a/WebKitTools/QueueStatusServer/stylesheets/main.css +++ /dev/null @@ -1,26 +0,0 @@ -body { - font-family: Verdana, Helvetica, sans-serif; -} - -#current_status { - padding: 5px; - font-size: larger; -} - -#last_status_date { - font-size: small; -} - -.recent_status { - padding-left: 10px; -} - -#recent_status_table { - font-size: small; - margin: 10px; -} - -#footer { - font-size: small; - padding-top: 10px; -} diff --git a/WebKitTools/QueueStatusServer/templates/dashboard.html b/WebKitTools/QueueStatusServer/templates/dashboard.html deleted file mode 100644 index f88a5ea..0000000 --- a/WebKitTools/QueueStatusServer/templates/dashboard.html +++ /dev/null @@ -1,44 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>WebKit Bot Status</title> -<link type="text/css" rel="stylesheet" href="/stylesheets/dashboard.css" /> -<script> -function statusDetail(patch_id) { - // FIXME: We'd like to use AJAX to show the details on this page. - window.location = "/patch/" + patch_id -} -</script> -</head> -<body> -<h1>WebKit Bot Status</h1> -<table> - <theader> - <tr> - <th>Bug</th> - <th>Attachment</th> - {% for header in headers %} - <th>{{ header }}</th> - {% endfor %} - </tr> - </thead> - <tbody>{% for row in rows %} - <tr> - <td class="status-cell"> - {{ row.bug_id|force_escape|webkit_bug_id|safe }} - </td> - <td class="status-cell"> - {{ row.attachment_id|force_escape|webkit_attachment_id|safe }} - </td> - {% for bubble in row.bubbles %} - <td class="status-cell {{ bubble.status_class }}" - {% if bubble.status %} - onclick="statusDetail({{ row.attachment_id }})" - title="{{ bubble.status_date|timesince }}" - {% endif %}> - </td> - {% endfor %} - </tr>{% endfor %} - </tbody> -</table> -</html> diff --git a/WebKitTools/QueueStatusServer/templates/includes/singlequeuestatus.html b/WebKitTools/QueueStatusServer/templates/includes/singlequeuestatus.html deleted file mode 100644 index 0adbfbd..0000000 --- a/WebKitTools/QueueStatusServer/templates/includes/singlequeuestatus.html +++ /dev/null @@ -1,9 +0,0 @@ -<span class="status-date">{{ status.date|timesince }} ago -{% if status.bot_id %} -({{ status.bot_id }}) -{% endif %} -</span> -<span class="status-message">{{ status.message|force_escape|urlize|webkit_linkify|safe }}</span> -{% if status.results_file %} - <span class="status-results">[{{ status.key.id|results_link|safe }}]</span> -{% endif %} diff --git a/WebKitTools/QueueStatusServer/templates/patch.html b/WebKitTools/QueueStatusServer/templates/patch.html deleted file mode 100644 index de334a5..0000000 --- a/WebKitTools/QueueStatusServer/templates/patch.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>Patch Status</title> -<link type="text/css" rel="stylesheet" href="/stylesheets/dashboard.css" /> -</head> -<body> -<h1> - Patch {{ attachment_id|force_escape|webkit_attachment_id|safe }} (Bug {{ bug_id|force_escape|webkit_bug_id|safe }}) -</h1>{% for queue_name, statuses in queue_status.items %} -<div class="status-details"> - <h2>{{ queue_name }}</h2> - <ul>{% for status in statuses %} - <li> - <span class="status-message">{{ status.message|force_escape|urlize|webkit_linkify|safe }}</span>{% if status.results_file %} - <span class="status-results">[{{ status.key.id|results_link|safe }}]</span>{% endif %} - <span class="status-date">{{ status.date|timesince }} ago</span> - </li>{% endfor %} - </ul> -</div>{% endfor %} -</html> diff --git a/WebKitTools/QueueStatusServer/templates/queuestatus.html b/WebKitTools/QueueStatusServer/templates/queuestatus.html deleted file mode 100644 index 1b98952..0000000 --- a/WebKitTools/QueueStatusServer/templates/queuestatus.html +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>{{ display_queue_name }} Status</title> -<link type="text/css" rel="stylesheet" href="/stylesheets/dashboard.css" /> -</head> -<body> -<h1>{{ display_queue_name }} Status</h1> - -<h3>Recent Status</h3> - -<div class="status-details"> - <ul> - {% for status_group in status_groups %} - {% with status_group.0 as title_status %} - <li class="status-group"> - {% if title_status.active_bug_id %} - <span class="status-bug"> - Patch {{ title_status.active_patch_id|force_escape|webkit_attachment_id|safe }} from bug - {{ title_status.active_bug_id|force_escape|webkit_bug_id|safe }}: - </span> - {% endif %} - - {% ifequal status_group|length 1 %} - {% with title_status as status %} - {% include 'includes/singlequeuestatus.html' %} - {% endwith %} - {% else %} - <ul> - {% for status in status_group %} - <li class="status"> - {% include 'includes/singlequeuestatus.html' %} - </li> - {% endfor %} - </ul> - {% endifequal %} - </li> - {% endwith %} - {% endfor %} - </ul> -</div> - -<h3>Patches in queue</h3> -<table> - <tr><th>Position</th><th>Patch</th><th>Lock Acquired</th></tr> - {% for row in work_item_rows %} - <tr> - <td>#{{ forloop.counter }}</td> - <td> - {{ row.attachment_id|force_escape|webkit_attachment_id|safe }} - </td> - <td> - {% if row.lock_time %} - {{ row.lock_time|timesince }} ago - {% endif %} - </td> - </tr> - {% endfor %} -</table> - -</body> -</html> diff --git a/WebKitTools/QueueStatusServer/templates/recentstatus.html b/WebKitTools/QueueStatusServer/templates/recentstatus.html deleted file mode 100644 index 808d8d7..0000000 --- a/WebKitTools/QueueStatusServer/templates/recentstatus.html +++ /dev/null @@ -1,54 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>WebKit Queue Status</title> -<link type="text/css" rel="stylesheet" href="/stylesheets/dashboard.css" /> -<style> -.queue_bubble { - border: 1px solid black; - margin-bottom: 10px; - border-radius: 10px; - padding: 5px; -} -.queue_name { - float:left; -} -.last_heard_from { - float: right; -} -.status_text { - clear: both; -} -.alive { - background-color: #8FDF5F; -} -.behind { - background-color: #FFFC6C; -} -.dead { - background-color: #E98080; -} -</style> -</head> -<body> -<h1>WebKit Queue Status</h1> -{% for queue in queues %} -<div class="queue_bubble {{ queue.status_class }}"> - <div class="queue_name"> - <a href="/queue-status/{{ queue.name }}"> - {{ queue.display_name }} - </a> - </div> - {% if queue.last_heard_from %} - <div class="last_heard_from">{{ queue.last_heard_from|timesince }} ago</div> - {% endif %} - <div class="status_text"> - Status: {{ queue.status_text|force_escape|urlize|webkit_linkify|safe }} - </div> - <div> - {{ queue.pending_items_count }} pending - </div> -</div> -{% endfor %} -</body> -</html> diff --git a/WebKitTools/QueueStatusServer/templates/releasepatch.html b/WebKitTools/QueueStatusServer/templates/releasepatch.html deleted file mode 100644 index cbd6d6f..0000000 --- a/WebKitTools/QueueStatusServer/templates/releasepatch.html +++ /dev/null @@ -1,3 +0,0 @@ -<form name="release_patch" enctype="multipart/form-data" method="post"> -Patch to release: <input name="attachment_id"> from <input name="queue_name"><input type="submit" value="Release locks and remove from queue"></div> -</form> diff --git a/WebKitTools/QueueStatusServer/templates/statusbubble.html b/WebKitTools/QueueStatusServer/templates/statusbubble.html deleted file mode 100644 index f11544d..0000000 --- a/WebKitTools/QueueStatusServer/templates/statusbubble.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<style> -body { - font-family: Verdana, sans-serif; - margin: 0px; - padding: 0px; -} -.status { - display: block; - float: left; - margin: 1px; - padding: 1px 2px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; - border: 1px solid #AAA; - background-color: white; - font-size: 11px; - cursor: pointer; -} -.none { - cursor: auto; -} -.pass { - background-color: #8FDF5F; - border: 1px solid #4F8530; -} -.fail { - background-color: #E98080; - border: 1px solid #A77272; -} -.pending { - background-color: #FFFC6C; - border: 1px solid #C5C56D; -} -.error { - background-color: #E0B0FF; - border: 1px solid #ACA0B3; -} -.queue_position { - font-size: 9px; -} -</style> -<script> -function statusDetail(patch_id) { - top.location = "/patch/" + patch_id -} -</script> -</head> -<body> -{% for bubble in bubbles %} -<div class="status {{ bubble.state }}"{% if bubble.status %} - onclick="statusDetail({{ bubble.attachment_id }})" - title="{{ bubble.status.date|timesince }} ago"{% endif %}> - {{ bubble.name }} - {% if bubble.queue_position %} - <span class="queue_position">#{{ bubble.queue_position }}</span> - {% endif %} -</div> -{% endfor %} -</body> -</html> diff --git a/WebKitTools/QueueStatusServer/templates/submittoews.html b/WebKitTools/QueueStatusServer/templates/submittoews.html deleted file mode 100644 index fb9d8aa..0000000 --- a/WebKitTools/QueueStatusServer/templates/submittoews.html +++ /dev/null @@ -1,3 +0,0 @@ -<form name="submit_to_ews" enctype="multipart/form-data" method="post"> -Patch to submit: <input name="attachment_id"><input type="submit" value="Submit for EWS Processing"></div> -</form> diff --git a/WebKitTools/QueueStatusServer/templates/updatestatus.html b/WebKitTools/QueueStatusServer/templates/updatestatus.html deleted file mode 100644 index 0f98ba4..0000000 --- a/WebKitTools/QueueStatusServer/templates/updatestatus.html +++ /dev/null @@ -1,21 +0,0 @@ -<form name="update_status" enctype="multipart/form-data" method="post"> -Update status for a queue: <input name="queue_name"> - <div> - Bot Id: - <input name="bot_id"> - </div> - <div> - Active Bug Id: - <input name="bug_id"> - </div> - <div> - Active Patch Id: - <input name="patch_id"> - </div> - <div> - Status Text:<br> - <textarea name="status" rows="3" cols="60"></textarea> - </div> - <div>Results file: <input type="file" name="results_file"></div> - <div><input type="submit" value="Add Status"></div> -</form> diff --git a/WebKitTools/QueueStatusServer/templates/updatesvnrevision.html b/WebKitTools/QueueStatusServer/templates/updatesvnrevision.html deleted file mode 100644 index 6ea4e7b..0000000 --- a/WebKitTools/QueueStatusServer/templates/updatesvnrevision.html +++ /dev/null @@ -1,8 +0,0 @@ -<form name="update_svn_revision" method="post"> -Update an SVN revision: <input name="number"> - <div> - Broken Bot: - <input name="broken_bot"> - </div> - <div><input type="submit" value="Update"></div> -</form> diff --git a/WebKitTools/QueueStatusServer/templates/updateworkitems.html b/WebKitTools/QueueStatusServer/templates/updateworkitems.html deleted file mode 100644 index b086fc3..0000000 --- a/WebKitTools/QueueStatusServer/templates/updateworkitems.html +++ /dev/null @@ -1,8 +0,0 @@ -<form name="update_work_items" enctype="multipart/form-data" method="post"> -Update work items for a queue: <input name="queue_name"> - <div> - Work Items: - <input name="work_items"> - </div> - <div><input type="submit" value="Update Work Items"></div> -</form> |