Changeset 56874 in webkit
- Timestamp:
- Mar 31, 2010 3:55:40 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r56871 r56874 1 2010-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 1 15 2010-03-31 Dirk Pranke <dpranke@chromium.org> 2 16 -
trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot.py
r56866 r56874 263 263 ] 264 264 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: 279 280 # We failed to find a link in the first cell, just give up. This 280 281 # can happen if a builder is just-added, the first cell will just … … 282 283 # Other parts of the code depend on is_green being present. 283 284 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]) 299 305 return builder 300 306 … … 361 367 return [self.builder_with_name(status["name"]) for status in self.builder_statuses()] 362 368 369 # This method pulls from /one_box_per_builder as an efficient way to get information about 363 370 def builder_statuses(self): 364 371 soup = BeautifulSoup(self._fetch_one_box_per_builder()) -
trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py
r56602 r56874 138 138 <td class="box"><a href="builders/Qt%20Linux%20Release">Qt Linux Release</a></td> 139 139 <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> 141 141 </table> 142 142 ''' … … 146 146 'build_number' : 3693, 147 147 'name': u'Windows Debug (Tests)', 148 'built_revision': 47380 148 'built_revision': 47380, 149 'activity': 'building', 150 'pending_builds': 0, 149 151 }, 150 152 { 151 153 'is_green': False, 154 'build_number' : None, 152 155 'name': u'SnowLeopard Intel Release', 156 'built_revision': None, 157 'activity': 'building', 158 'pending_builds': 0, 153 159 }, 154 160 { … … 156 162 'build_number' : 654, 157 163 'name': u'Qt Linux Release', 158 'built_revision': 47383 164 'built_revision': 47383, 165 'activity': 'idle', 166 'pending_builds': 3, 159 167 }, 160 168 ]
Note: See TracChangeset
for help on using the changeset viewer.