Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: app.py

Issue 12178026: Adds console renderer to merger backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-build
Patch Set: Responding to comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | merger.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import datetime 7 import datetime
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 def AddCategory(self, category, builder_status): 339 def AddCategory(self, category, builder_status):
340 self.category_order[self.lastMasterSeen].append(category) 340 self.category_order[self.lastMasterSeen].append(category)
341 # Map(k,v): k=Master/category, v=Dict of category data (last build status) 341 # Map(k,v): k=Master/category, v=Dict of category data (last build status)
342 self.category_data[self.lastMasterSeen].setdefault(category, {}) 342 self.category_data[self.lastMasterSeen].setdefault(category, {})
343 self.category_data[self.lastMasterSeen][category] = builder_status 343 self.category_data[self.lastMasterSeen][category] = builder_status
344 self.category_count += 1 344 self.category_count += 1
345 345
346 def AddRow(self, row): 346 def AddRow(self, row):
347 revision = row['rev_number'] 347 revision = row['rev_number']
348 self.SawRevision(revision) 348 self.SawRevision(revision)
349 revlink = BeautifulSoup(row['rev']).td.a['href'] 349 revlink = BeautifulSoup(row['rev']).a['href']
350 self.SetLink(revlink) 350 self.SetLink(revlink)
351 name = BeautifulSoup(row['name']).td.contents 351 name = BeautifulSoup(row['name'])
352 self.SetName(self.ContentsToHtml(name)) 352 self.SetName(self.ContentsToHtml(name))
353 status = BeautifulSoup(row['status']).findAll('table') 353 status = BeautifulSoup(row['status']).findAll('table')
354 for i, stat in enumerate(status): 354 for i, stat in enumerate(status):
355 self.SetStatus(self.category_order[self.lastMasterSeen][i], 355 self.SetStatus(self.category_order[self.lastMasterSeen][i],
356 unicode(stat)) 356 unicode(stat))
357 comment = BeautifulSoup(row['comment']).td.contents 357 comment = BeautifulSoup(row['comment'])
358 self.SetComment(self.ContentsToHtml(comment)) 358 self.SetComment(self.ContentsToHtml(comment))
359 if row['details']: 359 if row['details']:
360 details = BeautifulSoup(row['details']).td.contents 360 details = BeautifulSoup(row['details'])
361 self.SetDetail(self.ContentsToHtml(details)) 361 self.SetDetail(self.ContentsToHtml(details))
362 362
363 def ParseRow(self, row): 363 def ParseRow(self, row):
364 cells = row.findAll('td', recursive=False) 364 cells = row.findAll('td', recursive=False)
365 # Figure out which row this is. 365 # Figure out which row this is.
366 for attrname, attrvalue in cells[0].attrs: 366 for attrname, attrvalue in cells[0].attrs:
367 if attrname != 'class': 367 if attrname != 'class':
368 continue 368 continue
369 attrvalue = re.sub(r'^(\S+).*', r'\1', attrvalue) 369 attrvalue = re.sub(r'^(\S+).*', r'\1', attrvalue)
370 if attrvalue == 'DevRev': 370 if attrvalue == 'DevRev':
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 continue 417 continue
418 mergedconsole.SawMaster(master) 418 mergedconsole.SawMaster(master)
419 # Get the categories for this builder. If the builder doesn't have any 419 # Get the categories for this builder. If the builder doesn't have any
420 # categories, just use the default empty-string category. 420 # categories, just use the default empty-string category.
421 category_list = [] 421 category_list = []
422 master_categories = get_and_cache_pagedata('%s/console/categories' % master) 422 master_categories = get_and_cache_pagedata('%s/console/categories' % master)
423 if not master_categories['content']: 423 if not master_categories['content']:
424 category_list.append('') 424 category_list.append('')
425 else: 425 else:
426 category_row = BeautifulSoup(master_categories['content']) 426 category_row = BeautifulSoup(master_categories['content'])
427 category_list = map(lambda x: x.text, 427 category_list = [c.text for c in category_row.findAll('td', 'DevStatus')]
428 category_row.findAll('td', 'DevStatus'))
429 # Get the corresponding summary box(es). 428 # Get the corresponding summary box(es).
430 summary_row = BeautifulSoup(master_summary['content']) 429 summary_row = BeautifulSoup(master_summary['content'])
431 summary_list = summary_row.findAll('table') 430 summary_list = summary_row.findAll('table')
432 for category, summary in zip(category_list, summary_list): 431 for category, summary in zip(category_list, summary_list):
433 mergedconsole.AddCategory(category, summary) 432 mergedconsole.AddCategory(category, summary)
434 433
435 # Fetch all of the rows that we need. 434 # Fetch all of the rows that we need.
436 rows_fetched = 0 435 rows_fetched = 0
437 revs_skipped = 0 436 revs_skipped = 0
438 current_rev = latest_rev 437 current_rev = latest_rev
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 summary_data['title'] = 'Summary for ' + localpath 700 summary_data['title'] = 'Summary for ' + localpath
702 summary_data['content'] = unicode(summary) 701 summary_data['content'] = unicode(summary)
703 save_page(summary_page, localpath + '/summary', ts, summary_data) 702 save_page(summary_page, localpath + '/summary', ts, summary_data)
704 703
705 curr_row = {} 704 curr_row = {}
706 # Each table row is either a status row with a revision, name, and status, 705 # Each table row is either a status row with a revision, name, and status,
707 # a comment row with the commit message, a details row with flakiness info, 706 # a comment row with the commit message, a details row with flakiness info,
708 # or a spacer row (in which case we finalize the row and save it). 707 # or a spacer row (in which case we finalize the row and save it).
709 for row in rows: 708 for row in rows:
710 if row.find('td', 'DevComment'): 709 if row.find('td', 'DevComment'):
711 curr_row['comment'] = unicode(row) 710 curr_row['comment'] = ''.join(unicode(tag).strip() for tag in
711 row.td.contents)
712 elif row.find('td', 'DevDetails'): 712 elif row.find('td', 'DevDetails'):
713 curr_row['details'] = unicode(row) 713 curr_row['details'] = ''.join(unicode(tag).strip() for tag in
714 row.td.contents)
714 elif row.find('td', 'DevStatus'): 715 elif row.find('td', 'DevStatus'):
715 curr_row['rev'] = unicode(row.find('td', 'DevRev')) 716 curr_row['rev'] = unicode(row.find('td', 'DevRev').a)
716 curr_row['rev_number'] = unicode(row.find('td', 'DevRev').a.string) 717 curr_row['rev_number'] = unicode(row.find('td', 'DevRev').a.string)
717 curr_row['name'] = unicode(row.find('td', 'DevName')) 718 curr_row['name'] = ''.join(unicode(tag).strip() for tag in
718 curr_row['status'] = unicode(row.findAll('table')) 719 row.find('td', 'DevName').contents)
720 curr_row['status'] = ''.join(unicode(box.table) for box in
721 row.findAll('td', 'DevStatus'))
719 else: 722 else:
720 if 'details' not in curr_row: 723 if 'details' not in curr_row:
721 curr_row['details'] = '' 724 curr_row['details'] = ''
722 curr_row['fetch_timestamp'] = ts 725 curr_row['fetch_timestamp'] = ts
723 save_row(curr_row, localpath + '/' + curr_row['rev_number']) 726 save_row(curr_row, localpath + '/' + curr_row['rev_number'])
724 curr_row = {} 727 curr_row = {}
725 728
726 return page_data 729 return page_data
727 730
728 731
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 'builds/-1?as_text=1'), 1201 'builds/-1?as_text=1'),
1199 'localpath': 1202 'localpath':
1200 'chromium.lkgr/json/builders/Linux%20x64/builds/-1/as_text=1.json', 1203 'chromium.lkgr/json/builders/Linux%20x64/builds/-1/as_text=1.json',
1201 'maxage': 2*60, # 2 mins 1204 'maxage': 2*60, # 2 mins
1202 }, 1205 },
1203 1206
1204 # # Trigger background process update. 1207 # # Trigger background process update.
1205 # { 1208 # {
1206 # 'remoteurl': 'http://chromium-build.appspot.com/backend/update' 1209 # 'remoteurl': 'http://chromium-build.appspot.com/backend/update'
1207 ] 1210 ]
OLDNEW
« no previous file with comments | « no previous file | merger.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698