[ews-build] Show status bubbles while the patch is waiting in queue
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 20:58:12 +0000 (20:58 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 20:58:12 +0000 (20:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195618

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble): Added ALL_QUEUES and ENABLED_QUEUES. Only certain queues are
enabled in initial deployment.
(StatusBubble._build_bubble): Display bubble even when build hasn't started.
(StatusBubble.get_latest_build_for_queue): Get latest build for a given queue.
(StatusBubble.get_builds_for_queue): Get all builds for a given queue.
(StatusBubble._should_show_bubble_for): Display bubble for only ENABLED_QUEUES for now.
(StatusBubble._build_bubbles_for_patch):

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

Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py
Tools/ChangeLog

index 18fa4b3..6925345 100644 (file)
@@ -31,15 +31,24 @@ import ews.config as config
 
 
 class StatusBubble(View):
-    def _build_bubble(self, build, patch):
-        builder_display_name = build.builder_display_name
-        builder_full_name = build.builder_name
+    # These queue names are from shortname in https://trac.webkit.org/browser/webkit/trunk/Tools/BuildSlaveSupport/ews-build/config.json
+    # FIXME: Auto-generate this list https://bugs.webkit.org/show_bug.cgi?id=195640
+    ALL_QUEUES = ['api-ios', 'api-mac', 'bindings', 'gtk', 'ios', 'ios-sim', 'ios-wk2', 'jsc', 'mac', 'mac-32bit', 'mac-32bit-wk2',
+                    'mac-debug', 'mac-debug-wk1', 'mac-wk1', 'mac-wk2', 'style', 'webkitperl', 'webkitpy', 'win', 'wincairo', 'wpe']
+    ENABLED_QUEUES = ['api-ios', 'api-mac']
 
+    def _build_bubble(self, patch, queue):
         bubble = {
-            "name": builder_display_name,
-            "url": 'https://{}/#/builders/{}/builds/{}'.format(config.BUILDBOT_SERVER_HOST, build.builder_id, build.number),
+            "name": queue,
         }
+        build = self.get_latest_build_for_queue(patch, queue)
+        if not build:
+            bubble["state"] = "none"
+            bubble["details_message"] = 'Waiting in queue, processing has not started yet.'
+            return bubble
 
+        bubble["url"] = 'https://{}/#/builders/{}/builds/{}'.format(config.BUILDBOT_SERVER_HOST, build.builder_id, build.number)
+        builder_full_name = build.builder_name
         bubble["details_message"] = '{}\n{}'.format(builder_full_name, build.state_string)
         if build.result is None:
             bubble["state"] = "started"
@@ -60,24 +69,35 @@ class StatusBubble(View):
 
         return bubble
 
-    def _should_show_bubble_for(self, patch, build):
+    def get_latest_build_for_queue(self, patch, queue):
+        builds = self.get_builds_for_queue(patch, queue)
+        if not builds:
+            return None
+        builds.sort(key=lambda build: build.started_at, reverse=True)
+        return builds[0]
+
+    def get_builds_for_queue(self, patch, queue):
+        return [build for build in patch.build_set.all() if build.builder_display_name == queue]
+
+    def _should_show_bubble_for(self, patch, queue):
         # TODO: https://bugs.webkit.org/show_bug.cgi?id=194597
-        return True
+        return queue in StatusBubble.ENABLED_QUEUES
 
     def _build_bubbles_for_patch(self, patch):
         show_submit_to_ews = True
         failed_to_apply = False  # TODO: https://bugs.webkit.org/show_bug.cgi?id=194598
         bubbles = []
 
-        if not patch:
+        if not (patch and patch.sent_to_buildbot):
             return (None, show_submit_to_ews, failed_to_apply)
 
-        for build in patch.build_set.all():
-            show_submit_to_ews = False
-            if not self._should_show_bubble_for(patch, build):
+        for queue in StatusBubble.ALL_QUEUES:
+            if not self._should_show_bubble_for(patch, queue):
                 continue
-            bubble = self._build_bubble(build, patch)
+
+            bubble = self._build_bubble(patch, queue)
             if bubble:
+                show_submit_to_ews = False
                 bubbles.append(bubble)
 
         return (bubbles, show_submit_to_ews, failed_to_apply)
index e35b6cd..851f4d8 100644 (file)
@@ -1,3 +1,19 @@
+2019-03-12  Aakash Jain  <aakash_jain@apple.com>
+
+        [ews-build] Show status bubbles while the patch is waiting in queue
+        https://bugs.webkit.org/show_bug.cgi?id=195618
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
+        (StatusBubble): Added ALL_QUEUES and ENABLED_QUEUES. Only certain queues are 
+        enabled in initial deployment.
+        (StatusBubble._build_bubble): Display bubble even when build hasn't started.
+        (StatusBubble.get_latest_build_for_queue): Get latest build for a given queue.
+        (StatusBubble.get_builds_for_queue): Get all builds for a given queue.
+        (StatusBubble._should_show_bubble_for): Display bubble for only ENABLED_QUEUES for now.
+        (StatusBubble._build_bubbles_for_patch):
+
 2019-03-12  Robin Morisset  <rmorisset@apple.com>
 
         Alter Tools/Scripts/dump-class-layout to be able to dump all classes with suspicious padding