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

Unified Diff: milo/appengine/buildbot/builder.go

Issue 2931773004: Milo: Add machine pool info for buildbot builder view. (Closed)
Patch Set: Review Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/buildbot/build.go ('k') | milo/appengine/buildbot/master.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/builder.go
diff --git a/milo/appengine/buildbot/builder.go b/milo/appengine/buildbot/builder.go
index d8971b1b58786d73accc4616d774eab83f4bb5a6..2993b1b80154c705726e6bf49dc31ed3d7335170 100644
--- a/milo/appengine/buildbot/builder.go
+++ b/milo/appengine/buildbot/builder.go
@@ -164,6 +164,39 @@ func (e errBuilderNotFound) Error() string {
e.builder, e.master, avail)
}
+func summarizeSlavePool(
+ baseURL string, slaves []string, slaveMap map[string]*buildbotSlave) *resp.MachinePool {
+
+ mp := &resp.MachinePool{
+ Total: len(slaves),
+ Bots: make([]resp.Bot, 0, len(slaves)),
+ }
+ for _, slaveName := range slaves {
+ slave, ok := slaveMap[slaveName]
+ bot := resp.Bot{
+ Name: resp.Link{
+ Label: slaveName,
+ URL: fmt.Sprintf("%s/buildslaves/%s", baseURL, slaveName),
+ },
+ }
+ switch {
+ case !ok:
+ // This shouldn't happen
+ case !slave.Connected:
+ bot.Status = resp.Disconnected
+ mp.Disconnected++
+ case len(slave.RunningbuildsMap) > 0:
+ bot.Status = resp.Busy
+ mp.Busy++
+ default:
+ bot.Status = resp.Idle
+ mp.Idle++
+ }
+ mp.Bots = append(mp.Bots, bot)
+ }
+ return mp
+}
+
// builderImpl is the implementation for getting a milo builder page from buildbot.
// This gets:
// * Current Builds from querying the master json from the datastore.
@@ -184,7 +217,7 @@ func builderImpl(
result := &resp.Builder{
Name: builderName,
}
- master, t, err := getMasterJSON(c, masterName)
+ master, internal, t, err := getMasterJSON(c, masterName)
if err != nil {
return nil, err
}
@@ -226,6 +259,12 @@ func builderImpl(
}
}
+ baseURL := "https://build.chromium.org/p/"
+ if internal {
+ baseURL = "https://uberchromegw.corp.google.com/i/"
+ }
+ result.MachinePool = summarizeSlavePool(baseURL+master.Name, p.Slaves, master.Slaves)
+
// This is CPU bound anyways, so there's no need to do this in parallel.
finishedBuilds, nextCursor, err := getBuilds(c, masterName, builderName, true, limit, thisCursor)
if err != nil {
« no previous file with comments | « milo/appengine/buildbot/build.go ('k') | milo/appengine/buildbot/master.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698