Title: [261241] trunk/Tools
Revision
261241
Author
aakash_j...@apple.com
Date
2020-05-06 11:43:19 -0700 (Wed, 06 May 2020)

Log Message

Delete code for feeder queue
https://bugs.webkit.org/show_bug.cgi?id=211518

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/tool/bot/feeders.py: Removed.
* Scripts/webkitpy/tool/bot/feeders_unittest.py: Removed.
* Scripts/webkitpy/tool/commands/queues.py:
(FeederQueue): Deleted.
* Scripts/webkitpy/tool/commands/queues_unittest.py:
(TestFeederQueue): Deleted.
(FeederQueueTest): Deleted.
(PatchProcessingQueueTest): Deleted.

Modified Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (261240 => 261241)


--- trunk/Tools/ChangeLog	2020-05-06 18:32:48 UTC (rev 261240)
+++ trunk/Tools/ChangeLog	2020-05-06 18:43:19 UTC (rev 261241)
@@ -1,3 +1,19 @@
+2020-05-06  Aakash Jain  <aakash_j...@apple.com>
+
+        Delete code for feeder queue
+        https://bugs.webkit.org/show_bug.cgi?id=211518
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/tool/bot/feeders.py: Removed.
+        * Scripts/webkitpy/tool/bot/feeders_unittest.py: Removed.
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (FeederQueue): Deleted.
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        (TestFeederQueue): Deleted.
+        (FeederQueueTest): Deleted.
+        (PatchProcessingQueueTest): Deleted.
+
 2020-05-06  Darin Adler  <da...@apple.com>
 
         Eliminate checks of USE(DICTATION_ALTERNATIVES) in Cocoa-specific code

Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/feeders.py (261240 => 261241)


--- trunk/Tools/Scripts/webkitpy/tool/bot/feeders.py	2020-05-06 18:32:48 UTC (rev 261240)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/feeders.py	2020-05-06 18:43:19 UTC (rev 261241)
@@ -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 datetime import datetime, timedelta
-import logging
-
-from webkitpy.common.config.committervalidator import CommitterValidator
-from webkitpy.tool.grammar import pluralize
-
-_log = logging.getLogger(__name__)
-
-
-class AbstractFeeder(object):
-    def __init__(self, tool):
-        self._tool = tool
-
-    def feed(self):
-        raise NotImplementedError("subclasses must implement")
-
-
-class CommitQueueFeeder(AbstractFeeder):
-    queue_name = "commit-queue"
-
-    def __init__(self, tool):
-        AbstractFeeder.__init__(self, tool)
-        self.committer_validator = CommitterValidator(self._tool)
-
-    def feed(self):
-        patches = self._validate_patches()
-        patches = self._patches_with_acceptable_review_flag(patches)
-        patches = sorted(patches, key=lambda patch: patch.attach_date() or 0)
-
-        high_priority_item_ids = [patch.id() for patch in patches if patch.is_revert()]
-        item_ids = [patch.id() for patch in patches if not patch.is_revert()]
-
-        _log.info("Feeding %s high priority items %s, regular items %s" % (self.queue_name, high_priority_item_ids, item_ids))
-        self._tool.status_server.update_work_items(self.queue_name, high_priority_item_ids, item_ids)
-
-    def _patches_for_bug(self, bug_id):
-        return self._tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True)
-
-    # Filters out patches with r? or r-, only r+ or no review are OK to land.
-    def _patches_with_acceptable_review_flag(self, patches):
-        return [patch for patch in patches if patch.review() in [None, '+']]
-
-    def _validate_patches(self):
-        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
-        bug_ids = self._tool.bugs.queries.fetch_bug_ids_from_commit_queue()
-        all_patches = sum([self._patches_for_bug(bug_id) for bug_id in bug_ids], [])
-        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)
-
-
-class EWSFeeder(AbstractFeeder):
-    def __init__(self, tool):
-        self._ids_sent_to_server = set()
-        AbstractFeeder.__init__(self, tool)
-
-    def feed(self):
-        ids_needing_review = set(self._tool.bugs.queries.fetch_attachment_ids_from_review_queue(datetime.today() - timedelta(7)))
-        new_ids = ids_needing_review.difference(self._ids_sent_to_server)
-        _log.info("Feeding EWS (%s, %s new)" % (pluralize(len(ids_needing_review), "r? patch"), len(new_ids)))
-        for attachment_id in new_ids:  # Order doesn't really matter for the EWS.
-            self._tool.status_server.submit_to_ews(attachment_id)
-            self._ids_sent_to_server.add(attachment_id)

Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py (261240 => 261241)


--- trunk/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py	2020-05-06 18:32:48 UTC (rev 261240)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py	2020-05-06 18:43:19 UTC (rev 261241)
@@ -1,68 +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
-import unittest
-
-from webkitpy.common.system.outputcapture import OutputCapture
-from webkitpy.thirdparty.mock import Mock
-from webkitpy.tool.bot.feeders import *
-from webkitpy.tool.mocktool import MockTool
-
-
-class FeedersTest(unittest.TestCase):
-    def test_commit_queue_feeder(self):
-        self.maxDiff = None
-        feeder = CommitQueueFeeder(MockTool())
-        expected_logs = """Warning, attachment 10001 on bug 50000 has invalid committer (non-commit...@example.com)
-Warning, attachment 10001 on bug 50000 has invalid committer (non-commit...@example.com)
-MOCK setting flag 'commit-queue' to '-' on attachment '10001' with comment 'Rejecting attachment 10001 from commit-queue.\n\nnon-commit...@example.com does not have committer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json.
-
-- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
-
-- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
-Feeding commit-queue high priority items [10005], regular items [10000]
-MOCK: update_work_items: commit-queue [10005, 10000]
-"""
-        OutputCapture().assert_outputs(self, feeder.feed, expected_logs=expected_logs)
-
-    def _mock_attachment(self, is_revert, attach_date):
-        attachment = Mock()
-        attachment.is_revert = lambda: is_revert
-        attachment.attach_date = lambda: attach_date
-        return attachment
-
-    def test_patches_with_acceptable_review_flag(self):
-        class MockPatch(object):
-            def __init__(self, patch_id, review):
-                self.id = patch_id
-                self.review = lambda: review
-
-        feeder = CommitQueueFeeder(MockTool())
-        patches = [MockPatch(1, None), MockPatch(2, '-'), MockPatch(3, "+")]
-        self.assertEqual([patch.id for patch in feeder._patches_with_acceptable_review_flag(patches)], [1, 3])

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (261240 => 261241)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2020-05-06 18:32:48 UTC (rev 261240)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2020-05-06 18:43:19 UTC (rev 261241)
@@ -44,7 +44,6 @@
 from webkitpy.common.unicode_compatibility import BytesIO
 from webkitpy.tool.bot.botinfo import BotInfo
 from webkitpy.tool.bot.commitqueuetask import CommitQueueTask, CommitQueueTaskDelegate
-from webkitpy.tool.bot.feeders import CommitQueueFeeder, EWSFeeder
 from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter
 from webkitpy.tool.bot.layouttestresultsreader import LayoutTestResultsReader
 from webkitpy.tool.bot.patchanalysistask import UnableToApplyPatch, PatchIsNotValid
@@ -173,39 +172,6 @@
         return tool.status_server.update_status(cls.name, message, state["patch"], failure_log)
 
 
-class FeederQueue(AbstractQueue):
-    name = "feeder-queue"
-
-    _sleep_duration = 30  # seconds
-
-    # AbstractQueue methods
-
-    def begin_work_queue(self):
-        AbstractQueue.begin_work_queue(self)
-        self.feeders = [
-            CommitQueueFeeder(self._tool),
-            EWSFeeder(self._tool),
-        ]
-
-    def next_work_item(self):
-        # This really show inherit from some more basic class that doesn't
-        # understand work items, but the base class in the heirarchy currently
-        # understands work items.
-        return "synthetic-work-item"
-
-    def process_work_item(self, work_item):
-        for feeder in self.feeders:
-            feeder.feed()
-        time.sleep(self._sleep_duration)
-        return True
-
-    def work_item_log_path(self, work_item):
-        return None
-
-    def handle_unexpected_error(self, work_item, message):
-        _log.error(message)
-
-
 class AbstractPatchQueue(AbstractQueue):
     def _update_status(self, message, patch=None, results_file=None):
         return self._tool.status_server.update_status(self.name, message, patch, results_file)

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (261240 => 261241)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2020-05-06 18:32:48 UTC (rev 261240)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2020-05-06 18:43:19 UTC (rev 261241)
@@ -68,10 +68,6 @@
     name = "test-review-queue"
 
 
-class TestFeederQueue(FeederQueue):
-    _sleep_duration = 0
-
-
 class AbstractQueueTest(CommandsTest):
     def test_log_directory(self):
         self.assertEqual(TestQueue()._log_directory(), os.path.join("..", "test-queue-logs"))
@@ -128,30 +124,6 @@
         self._assert_log_message(script_error, expected_output)
 
 
-class FeederQueueTest(QueuesTest):
-    def test_feeder_queue(self):
-        self.maxDiff = None
-        queue = TestFeederQueue()
-        tool = MockTool(log_executive=True)
-        expected_logs = {
-            "begin_work_queue": self._default_begin_work_queue_logs("feeder-queue"),
-            "process_work_item": """Warning, attachment 10001 on bug 50000 has invalid committer (non-commit...@example.com)
-Warning, attachment 10001 on bug 50000 has invalid committer (non-commit...@example.com)
-MOCK setting flag 'commit-queue' to '-' on attachment '10001' with comment 'Rejecting attachment 10001 from commit-queue.\n\nnon-commit...@example.com does not have committer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json.
-
-- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
-
-- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
-Feeding commit-queue high priority items [10005], regular items [10000]
-MOCK: update_work_items: commit-queue [10005, 10000]
-Feeding EWS (1 r? patch, 1 new)
-MOCK: submit_to_old_ews: 10002
-""",
-            "handle_unexpected_error": "Mock error message\n",
-        }
-        self.assert_queue_outputs(queue, tool=tool, expected_logs=expected_logs)
-
-
 class AbstractPatchQueueTest(CommandsTest):
     def test_next_patch(self):
         queue = AbstractPatchQueue()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to