Home | Trees | Indices | Help |
|
---|
|
1 2 import time, urllib 3 from twisted.web import html 4 from twisted.web.util import Redirect 5 from twisted.web.error import NoResource 6 7 from buildbot.status.web.base import HtmlResource, abbreviate_age, \ 8 BuildLineMixin, path_to_slave, path_to_authfail 9 from buildbot import util 10 11 # /buildslaves/$slavename13 addSlash = False 1776 77 # /buildslaves19 return "Buildbot: %s" % self.slavename2022 s = self.getStatus(req) 23 slave = s.getSlave(self.slavename) 24 if path == "shutdown": 25 if self.getAuthz(req).actionAllowed("gracefulShutdown", req, slave): 26 slave.setGraceful(True) 27 else: 28 return Redirect(path_to_authfail(req)) 29 return Redirect(path_to_slave(req, slave))30 32 s = self.getStatus(request) 33 slave = s.getSlave(self.slavename) 34 35 my_builders = [] 36 for bname in s.getBuilderNames(): 37 b = s.getBuilder(bname) 38 for bs in b.getSlaves(): 39 if bs.getName() == self.slavename: 40 my_builders.append(b) 41 42 # Current builds 43 current_builds = [] 44 for b in my_builders: 45 for cb in b.getCurrentBuilds(): 46 if cb.getSlavename() == self.slavename: 47 current_builds.append(self.get_line_values(request, cb)) 48 49 try: 50 max_builds = int(request.args.get('numbuilds')[0]) 51 except: 52 max_builds = 10 53 54 recent_builds = [] 55 n = 0 56 for rb in s.generateFinishedBuilds(builders=[b.getName() for b in my_builders]): 57 if rb.getSlavename() == self.slavename: 58 n += 1 59 recent_builds.append(self.get_line_values(request, rb)) 60 if n > max_builds: 61 break 62 ctx.update(dict(slave = s.getSlave(self.slavename), 63 slavename = self.slavename, 64 current = current_builds, 65 recent = recent_builds, 66 shutdown_url = request.childLink("shutdown"), 67 authz = self.getAuthz(request), 68 this_url = "../../../" + path_to_slave(request, slave), 69 access_uri = slave.getAccessURI()), 70 admin = unicode(slave.getAdmin() or '', 'utf-8'), 71 host = unicode(slave.getHost() or '', 'utf-8'), 72 show_builder_column = True) 73 template = request.site.buildbot_service.templates.get_template("buildslave.html") 74 data = template.render(**ctx) 75 return data79 title = "BuildSlaves" 80 addSlash = True 8113483 s = self.getStatus(request) 84 85 #?no_builders=1 disables build column 86 show_builder_column = not (request.args.get('no_builders', '0')[0])=='1' 87 ctx['show_builder_column'] = show_builder_column 88 89 used_by_builder = {} 90 for bname in s.getBuilderNames(): 91 b = s.getBuilder(bname) 92 for bs in b.getSlaves(): 93 slavename = bs.getName() 94 if slavename not in used_by_builder: 95 used_by_builder[slavename] = [] 96 used_by_builder[slavename].append(bname) 97 98 slaves = ctx['slaves'] = [] 99 for name in util.naturalSort(s.getSlaveNames()): 100 info = {} 101 slaves.append(info) 102 slave = s.getSlave(name) 103 slave_status = s.botmaster.slaves[name].slave_status 104 info['running_builds'] = len(slave_status.getRunningBuilds()) 105 info['link'] = request.childLink(urllib.quote(name,'')) 106 info['name'] = name 107 108 if show_builder_column: 109 info['builders'] = [] 110 for b in used_by_builder.get(name, []): 111 info['builders'].append(dict(link=request.childLink("../builders/%s" % b), name=b)) 112 113 info['version'] = slave.getVersion() 114 info['connected'] = slave.isConnected() 115 116 if slave.isConnected(): 117 info['admin'] = unicode(slave.getAdmin() or '', 'utf-8') 118 last = slave.lastMessageReceived() 119 if last: 120 info['last_heard_from_age'] = abbreviate_age(time.time() - last) 121 info['last_heard_from_time'] = time.strftime("%Y-%b-%d %H:%M:%S", 122 time.localtime(last)) 123 124 template = request.site.buildbot_service.templates.get_template("buildslaves.html") 125 data = template.render(**ctx) 126 return data127
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue May 25 17:53:31 2010 | http://epydoc.sourceforge.net |