Changeset 56874 in webkit


Ignore:
Timestamp:
Mar 31, 2010 3:55:40 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-31 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Teach buildbot.py how to parse builder activity from /one_box_per_builder
https://bugs.webkit.org/show_bug.cgi?id=36898

I also removed some obsolete FIXMEs and
refactored one_box_per_builder parsing into multiple
methods for easier reading.

  • Scripts/webkitpy/common/net/buildbot.py:
  • Scripts/webkitpy/common/net/buildbot_unittest.py:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56871 r56874  
     12010-03-31  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Teach buildbot.py how to parse builder activity from /one_box_per_builder
     6        https://bugs.webkit.org/show_bug.cgi?id=36898
     7
     8        I also removed some obsolete FIXMEs and
     9        refactored one_box_per_builder parsing into multiple
     10        methods for easier reading.
     11
     12        * Scripts/webkitpy/common/net/buildbot.py:
     13        * Scripts/webkitpy/common/net/buildbot_unittest.py:
     14
    1152010-03-31  Dirk Pranke  <dpranke@chromium.org>
    216
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot.py

    r56866 r56874  
    263263        ]
    264264
    265     # FIXME: This should create and return Buidler and Build objects instead
    266     # of a custom dictionary.
    267     def _parse_builder_status_from_row(self, status_row):
    268         # If WebKit's buildbot has an XMLRPC interface we could use, we could
    269         # do something more sophisticated here.  For now we just parse out the
    270         # basics, enough to support basic questions like "is the tree green?"
    271         status_cells = status_row.findAll('td')
    272         builder = {}
    273 
    274         name_link = status_cells[0].find('a')
    275         builder['name'] = name_link.string
    276 
    277         status_link = status_cells[1].find('a')
    278         if not status_link:
     265    def _parse_last_build_cell(self, builder, cell):
     266        status_link = cell.find('a')
     267        if status_link:
     268            # Will be either a revision number or a build number
     269            revision_string = status_link.string
     270            # If revision_string has non-digits assume it's not a revision number.
     271            builder['built_revision'] = int(revision_string) \
     272                                        if not re.match('\D', revision_string) \
     273                                        else None
     274            builder['is_green'] = not re.search('fail', cell.renderContents())
     275
     276            status_link_regexp = r"builders/(?P<builder_name>.*)/builds/(?P<build_number>\d+)"
     277            link_match = re.match(status_link_regexp, status_link['href'])
     278            builder['build_number'] = int(link_match.group("build_number"))
     279        else:
    279280            # We failed to find a link in the first cell, just give up.  This
    280281            # can happen if a builder is just-added, the first cell will just
     
    282283            # Other parts of the code depend on is_green being present.
    283284            builder['is_green'] = False
    284             return builder
    285         # Will be either a revision number or a build number
    286         revision_string = status_link.string
    287         # If revision_string has non-digits assume it's not a revision number.
    288         builder['built_revision'] = int(revision_string) \
    289                                     if not re.match('\D', revision_string) \
    290                                     else None
    291         builder['is_green'] = not re.search('fail',
    292                                             status_cells[1].renderContents())
    293 
    294         status_link_regexp = r"builders/(?P<builder_name>.*)/builds/(?P<build_number>\d+)"
    295         link_match = re.match(status_link_regexp, status_link['href'])
    296         builder['build_number'] = int(link_match.group("build_number"))
    297 
    298         # We could parse out the current activity too.
     285            builder['built_revision'] = None
     286            builder['build_number'] = None
     287
     288    def _parse_current_build_cell(self, builder, cell):
     289        activity_lines = cell.renderContents().split("<br />")
     290        builder["activity"] = activity_lines[0] # normally "building" or "idle"
     291        # The middle lines document how long left for any current builds.
     292        match = re.match("(?P<pending_builds>\d) pending", activity_lines[-1])
     293        builder["pending_builds"] = int(match.group("pending_builds")) if match else 0
     294
     295    def _parse_builder_status_from_row(self, status_row):
     296        status_cells = status_row.findAll('td')
     297        builder = {}
     298
     299        # First cell is the name
     300        name_link = status_cells[0].find('a')
     301        builder["name"] = name_link.string
     302
     303        self._parse_last_build_cell(builder, status_cells[1])
     304        self._parse_current_build_cell(builder, status_cells[2])
    299305        return builder
    300306
     
    361367        return [self.builder_with_name(status["name"]) for status in self.builder_statuses()]
    362368
     369    # This method pulls from /one_box_per_builder as an efficient way to get information about
    363370    def builder_statuses(self):
    364371        soup = BeautifulSoup(self._fetch_one_box_per_builder())
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py

    r56602 r56874  
    138138    <td class="box"><a href="builders/Qt%20Linux%20Release">Qt Linux Release</a></td>
    139139      <td align="center" class="LastBuild box failure"><a href="builders/Qt%20Linux%20Release/builds/654">47383</a><br />failed<br />compile-webkit</td>
    140       <td align="center" class="Activity idle">idle</td>
     140      <td align="center" class="Activity idle">idle<br />3 pending</td>
    141141    </table>
    142142'''
     
    146146            'build_number' : 3693,
    147147            'name': u'Windows Debug (Tests)',
    148             'built_revision': 47380
     148            'built_revision': 47380,
     149            'activity': 'building',
     150            'pending_builds': 0,
    149151        },
    150152        {
    151153            'is_green': False,
     154            'build_number' : None,
    152155            'name': u'SnowLeopard Intel Release',
     156            'built_revision': None,
     157            'activity': 'building',
     158            'pending_builds': 0,
    153159        },
    154160        {
     
    156162            'build_number' : 654,
    157163            'name': u'Qt Linux Release',
    158             'built_revision': 47383
     164            'built_revision': 47383,
     165            'activity': 'idle',
     166            'pending_builds': 3,
    159167        },
    160168    ]
Note: See TracChangeset for help on using the changeset viewer.