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

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

Issue 2409953002: Milo: Display pending builds (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | milo/appengine/buildbot/structs.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 2c6b56ece5e2064571b23b7266d10868d75c6913..e29cf46d236b986e97e1a5f8b5c60b046f938270 100644
--- a/milo/appengine/buildbot/builder.go
+++ b/milo/appengine/buildbot/builder.go
@@ -7,7 +7,6 @@ package buildbot
import (
"encoding/json"
"fmt"
- "os"
"sort"
"strings"
"time"
@@ -133,7 +132,7 @@ func builderImpl(c context.Context, masterName, builderName string) (*resp.Build
s, _ := json.Marshal(master)
logging.Debugf(c, "Master: %s", s)
- _, ok := master.Builders[builderName]
+ p, ok := master.Builders[builderName]
if !ok {
// This long block is just to return a good error message when an invalid
// buildbot builder is specified.
@@ -147,14 +146,40 @@ func builderImpl(c context.Context, masterName, builderName string) (*resp.Build
"Cannot find builder %s in master %s.\nAvailable builders: \n%s",
builderName, masterName, avail)
}
+ // Extract pending builds out of the master json.
+ result.PendingBuilds = make([]*resp.BuildSummary, len(p.PendingBuildStates))
+ logging.Debugf(c, "Number of pending builds: %d", len(p.PendingBuildStates))
+ for i, pb := range p.PendingBuildStates {
+ start := time.Unix(int64(pb.SubmittedAt), 0)
+ result.PendingBuilds[i] = &resp.BuildSummary{
+ PendingTime: resp.Interval{
+ Started: start,
+ Duration: time.Now().Sub(start),
+ },
+ }
+ result.PendingBuilds[i].Blame = make([]*resp.Commit, len(pb.Source.Changes))
+ for j, cm := range pb.Source.Changes {
+ result.PendingBuilds[i].Blame[j] = &resp.Commit{
+ AuthorEmail: cm.Who,
+ CommitURL: cm.Revlink,
+ }
+ }
+ }
recentBuilds, err := getBuilds(c, masterName, builderName, true)
if err != nil {
- return nil, err // Or maybe not?
+ return nil, err
+ }
+ /* TODO(hinoka): This works, but there's a lot of junk data from
estaab 2016/10/11 16:16:27 How about uncommenting so we can see the debug out
hinoka 2016/10/12 02:09:20 Done.
+ * masters with unclean shutdown. Need to implement a cleanup
+ * procedure of some sort.
+ currentBuilds, err := getBuilds(c, masterName, builderName, false)
+ if err != nil {
+ return nil, err
}
- currentBuilds := getCurrentBuilds(c, master, builderName)
- fmt.Fprintf(os.Stderr, "Number of current builds: %d\n", len(currentBuilds))
+ logging.Debugf(c, "Number of current builds: %d", len(currentBuilds))
result.CurrentBuilds = currentBuilds
+ */
for _, fb := range recentBuilds {
// Yes recent builds is synonymous with finished builds.
// TODO(hinoka): Implement limits.
« no previous file with comments | « no previous file | milo/appengine/buildbot/structs.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698