Changeset 60924 in webkit


Ignore:
Timestamp:
Jun 9, 2010 5:28:03 PM (14 years ago)
Author:
ojan@chromium.org
Message:

2010-06-09 Ojan Vafai <ojan@chromium.org>

Reviewed by Adam Barth.

make rietveld upload faster and avoid posting to bug on errors
https://bugs.webkit.org/show_bug.cgi?id=40389

Only grab the first item of the upload queue instead of trying
to compute the whole list upfront (which is O(n) bugzilla lookups!).

Also, don't post comments to the bug when uploading fails.

  • Scripts/webkitpy/common/net/bugzilla.py:
  • Scripts/webkitpy/tool/commands/queues.py:
  • Scripts/webkitpy/tool/commands/queues_unittest.py:
  • Scripts/webkitpy/tool/commands/stepsequence.py:
  • Scripts/webkitpy/tool/mocktool.py:
Location:
trunk/WebKitTools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r60903 r60924  
     12010-06-09  Ojan Vafai  <ojan@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        make rietveld upload faster and avoid posting to bug on errors
     6        https://bugs.webkit.org/show_bug.cgi?id=40389
     7
     8        Only grab the first item of the upload queue instead of trying
     9        to compute the whole list upfront (which is O(n) bugzilla lookups!).
     10
     11        Also, don't post comments to the bug when uploading fails.
     12
     13        * Scripts/webkitpy/common/net/bugzilla.py:
     14        * Scripts/webkitpy/tool/commands/queues.py:
     15        * Scripts/webkitpy/tool/commands/queues_unittest.py:
     16        * Scripts/webkitpy/tool/commands/stepsequence.py:
     17        * Scripts/webkitpy/tool/mocktool.py:
     18
    1192010-06-09  Ojan Vafai  <ojan@chromium.org>
    220
  • trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py

    r60903 r60924  
    206206
    207207    def in_rietveld_queue_patches(self):
    208         return [patch for patch in self.patches() if patch.in_rietveld() == "?"]
     208        return [patch for patch in self.patches() if (
     209            patch.in_rietveld() == "?" or patch.in_rietveld() == None and patch.review() == "?")]
    209210
    210211
     
    271272                    for bug_id in self.fetch_bug_ids_from_commit_queue()], [])
    272273
    273     def _fetch_bug_ids_from_rietveld_queue(self):
     274    def _fetch_rietveld_queue_patch(self, query_url):
     275        bugs = self._fetch_bug_ids_advanced_query(query_url)
     276        if not len(bugs):
     277            return None
     278
     279        patches = self._fetch_bug(bugs[0]).in_rietveld_queue_patches()
     280        return patches[0] if len(patches) else None
     281
     282    def fetch_first_patch_from_rietveld_queue(self):
    274283        # rietveld-queue processes in-rietveld? patches and then marks them in-rietveld-/+.
    275284        # in-rietveld? patches
    276285        rietveld_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=in-rietveld%3F&order=Last+Changed"
    277         in_rietveld_bugs = self._fetch_bug_ids_advanced_query(rietveld_queue_url)
     286        patch = self._fetch_rietveld_queue_patch(rietveld_queue_url)
     287        if patch:
     288            return patch
    278289
    279290        # review? patches that don't have an in-rietveld flag.
    280291        review_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review%3F&field0-1-0=flagtypes.name&type0-1-0=notsubstring&value0-1-0=in-rietveld&order=Last+Changed"
    281         in_rietveld_bugs.extend(self._fetch_bug_ids_advanced_query(review_queue_url))
    282 
    283         return in_rietveld_bugs
    284 
    285     def fetch_patches_from_rietveld_queue(self):
    286         return sum([self._fetch_bug(bug_id).in_rietveld_queue_patches()
    287                     for bug_id in self._fetch_bug_ids_from_rietveld_queue()], [])
     292        patch = self._fetch_rietveld_queue_patch(review_queue_url)
     293        if patch:
     294            return patch
     295
     296        return None
    288297
    289298    def _fetch_bug_ids_from_review_queue(self):
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues.py

    r60903 r60924  
    290290
    291291    # StepSequenceErrorHandler methods
     292    @staticmethod
     293    def _error_message_for_bug(tool, status_id, script_error):
     294        if not script_error.output:
     295            return script_error.message_with_output()
     296        results_link = tool.status_server.results_url_for_status(status_id)
     297        return "%s\nFull output: %s" % (script_error.message_with_output(), results_link)
    292298
    293299    @classmethod
     
    307313
    308314    def next_work_item(self):
    309         patches = self.tool.bugs.queries.fetch_patches_from_rietveld_queue()
    310         if patches:
    311             return patches[0]
     315        patch_id = self.tool.bugs.queries.fetch_first_patch_from_rietveld_queue()
     316        if patch_id:
     317            return patch_id
    312318        self._update_status("Empty queue")
    313319
     
    326332            raise e
    327333
    328     def _reject_patch(self, patch, message):
    329         comment_text = "Could not upload patch %s to rietveld. Rietveld is down or there's a bug in the upload bot." % patch.id()
    330         self.tool.bugs.set_flag_on_attachment(patch.id(), "in-rietveld", "-", comment_text, message)
     334    def _reject_patch(self, patch_id, message):
     335        self.tool.bugs.set_flag_on_attachment(patch_id, "in-rietveld", "-")
    331336
    332337    def handle_unexpected_error(self, patch, message):
    333         self._reject_patch(patch, message)
     338        self._reject_patch(patch.id(), message)
    334339
    335340    # StepSequenceErrorHandler methods
     
    338343    def handle_script_error(cls, tool, state, script_error):
    339344        status_id = cls._update_status_for_script_error(tool, state, script_error)
    340         cls._reject_patch(patch, cls._error_message_for_bug(tool, status_id, script_error))
     345        cls._reject_patch(state["patch"].id())
    341346
    342347
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py

    r60903 r60924  
    206206            "should_proceed_with_work_item": "MOCK: update_status: rietveld-upload-queue Uploading patch\n",
    207207            "process_work_item": "MOCK: update_status: rietveld-upload-queue Pass\n",
    208             "handle_unexpected_error": "MOCK setting flag 'in-rietveld' to '-' on attachment '1234' with comment 'Could not upload patch 1234 to rietveld. Rietveld is down or there's a bug in the upload bot.' and additional comment 'Mock error message'\n",
     208            "handle_unexpected_error": "MOCK setting flag 'in-rietveld' to '-' on attachment '1234' with comment 'None' and additional comment 'None'\n",
    209209        }
    210210        self.assert_queue_outputs(RietveldUploadQueue(), expected_stderr=expected_stderr)
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/stepsequence.py

    r60635 r60924  
    3636
    3737class StepSequenceErrorHandler():
    38     # FIXME: StepSequenceErrorHandler is just an interface definition.
    39     # It shouldn't have any implementations.
    40     # Create an intermediate class that inherits from StepSequenceErrorHandler
    41     # that the appropriate queues inherit from.
    42     @staticmethod
    43     def _error_message_for_bug(tool, status_id, script_error):
    44         if not script_error.output:
    45             return script_error.message_with_output()
    46         results_link = tool.status_server.results_url_for_status(status_id)
    47         return "%s\nFull output: %s" % (script_error.message_with_output(), results_link)
    48 
    4938    @classmethod
    5039    def handle_script_error(cls, tool, patch, script_error):
  • trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py

    r60903 r60924  
    226226        return sum([bug.reviewed_patches() for bug in self._all_bugs()], [])
    227227
    228     def fetch_patches_from_rietveld_queue(self):
    229         return sum([bug.in_rietveld_queue_patches() for bug in self._all_bugs()], [])
     228    def fetch_first_patch_from_rietveld_queue(self):
     229        for bug in self._all_bugs():
     230            patches = bug.in_rietveld_queue_patches()
     231            if len(patches):
     232                return patches[0]
     233        raise Exception('No patches in the rietveld queue')
    230234
    231235# FIXME: Bugzilla is the wrong Mock-point.  Once we have a BugzillaNetwork
Note: See TracChangeset for help on using the changeset viewer.