Record latest message in PatchLog for quick access
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Oct 2014 21:35:16 +0000 (21:35 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Oct 2014 21:35:16 +0000 (21:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137405

Reviewed by Ryosuke Niwa.

It's no SQL...

* QueueStatusServer/handlers/releasepatch.py:
* QueueStatusServer/handlers/updatestatus.py:
* QueueStatusServer/loggers/recordpatchevent.py:
* QueueStatusServer/model/patchlog.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/QueueStatusServer/app.yaml
Tools/QueueStatusServer/handlers/releasepatch.py
Tools/QueueStatusServer/handlers/updatestatus.py
Tools/QueueStatusServer/loggers/recordpatchevent.py
Tools/QueueStatusServer/model/patchlog.py

index e269d70..36ff0d2 100644 (file)
@@ -1,3 +1,17 @@
+2014-10-03  Alexey Proskuryakov  <ap@apple.com>
+
+        Record latest message in PatchLog for quick access
+        https://bugs.webkit.org/show_bug.cgi?id=137405
+
+        Reviewed by Ryosuke Niwa.
+
+        It's no SQL...
+
+        * QueueStatusServer/handlers/releasepatch.py:
+        * QueueStatusServer/handlers/updatestatus.py:
+        * QueueStatusServer/loggers/recordpatchevent.py:
+        * QueueStatusServer/model/patchlog.py:
+
 2014-10-02  David Farler  <dfarler@apple.com>
 
         -asan-blacklist option also renamed to generic -fsanitize-blacklist
index b281261..625aa91 100644 (file)
@@ -1,5 +1,5 @@
 application: webkit-queues
-version: 174248 # Bugzilla bug ID of last major change
+version: 174291 # Bugzilla bug ID of last major change
 runtime: python
 api_version: 1
 
index 87d17c5..3d8f7e0 100644 (file)
@@ -55,6 +55,6 @@ class ReleasePatch(UpdateBase):
         # WorkItems and ActiveWorkItems.
 
         queue.work_items().remove_work_item(attachment_id)
-        RecordPatchEvent.stopped(attachment_id, queue_name)
+        RecordPatchEvent.stopped(attachment_id, queue_name, last_status)
 
         queue.active_work_items().expire_item(attachment_id)
index b02e987..93a3a9b 100644 (file)
@@ -66,5 +66,5 @@ class UpdateStatus(UpdateBase):
         queue_status.put()
         RecordBotEvent.record_activity(queue_status.queue_name, queue_status.bot_id)
         if queue_status.active_patch_id:
-            RecordPatchEvent.updated(queue_status.active_patch_id, queue_status.queue_name, queue_status.bot_id)
+            RecordPatchEvent.updated(queue_status.active_patch_id, queue_status.queue_name, queue_status.message, queue_status.bot_id)
         self.response.out.write(queue_status.key().id())
index 5974478..b76cd58 100644 (file)
@@ -69,7 +69,7 @@ class RecordPatchEvent(object):
             queue_log.put()
 
     @classmethod
-    def stopped(cls, attachment_id, queue_name, bot_id=None):
+    def stopped(cls, attachment_id, queue_name, status_message, bot_id=None):
         patch_log = PatchLog.lookup_if_exists(attachment_id, queue_name)
         if not patch_log:
             WarningLog.record("patchlog missing", "In stopped event.", attachment_id, queue_name, bot_id)
@@ -84,6 +84,7 @@ class RecordPatchEvent(object):
                 patch_log.bot_id = bot_id
             patch_log.finished = True
             patch_log.calculate_process_duration()
+            patch_log.latest_message = status_message
             patch_log.put()
 
             queue_log = QueueLog.get_current(queue_name, queue_log_duration)
@@ -91,7 +92,7 @@ class RecordPatchEvent(object):
             queue_log.put()
 
     @classmethod
-    def updated(cls, attachment_id, queue_name, bot_id=None):
+    def updated(cls, attachment_id, queue_name, status_message, bot_id=None):
         patch_log = PatchLog.lookup_if_exists(attachment_id, queue_name)
         if not patch_log:
             WarningLog.record("patchlog missing", "In updated event.", attachment_id, queue_name, bot_id)
@@ -100,6 +101,7 @@ class RecordPatchEvent(object):
         if bot_id:
             patch_log.bot_id = bot_id
         patch_log.status_update_count += 1
+        patch_log.latest_message = status_message
         patch_log.put()
 
         queue_log = QueueLog.get_current(queue_name, queue_log_duration)
index 78254da..2ca0869 100644 (file)
@@ -41,6 +41,7 @@ class PatchLog(db.Model):
     finished = db.BooleanProperty(default=False)
     wait_duration = db.IntegerProperty()
     process_duration = db.IntegerProperty()
+    latest_message = db.StringProperty()
 
     @classmethod
     def lookup(cls, attachment_id, queue_name):