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

Side by Side Diff: milo/appengine/buildbot/console.go

Issue 2810113002: Milo buildbot builder page: Add pagnation with cursors. (Closed)
Patch Set: train Created 3 years, 8 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
« no previous file with comments | « milo/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/datastore.go » ('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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "strings" 9 "strings"
10 10
11 ds "github.com/luci/gae/service/datastore" 11 ds "github.com/luci/gae/service/datastore"
12 "github.com/luci/luci-go/common/clock" 12 "github.com/luci/luci-go/common/clock"
13 log "github.com/luci/luci-go/common/logging" 13 log "github.com/luci/luci-go/common/logging"
14 "github.com/luci/luci-go/common/sync/parallel" 14 "github.com/luci/luci-go/common/sync/parallel"
15 "github.com/luci/luci-go/milo/api/resp" 15 "github.com/luci/luci-go/milo/api/resp"
16 16
17 "golang.org/x/net/context" 17 "golang.org/x/net/context"
18 ) 18 )
19 19
20 // getFullBuilds fetches all of the recent builds from the datastore. 20 // getFullBuilds fetches all of the recent builds from the datastore.
21 func getFullBuilds(c context.Context, masterName, builderName string, finished b ool) ([]*buildbotBuild, error) { 21 func getFullBuilds(c context.Context, masterName, builderName string, finished b ool) ([]*buildbotBuild, error) {
22 // TODO(hinoka): Builder specific structs. 22 // TODO(hinoka): Builder specific structs.
23 q := ds.NewQuery("buildbotBuild") 23 q := ds.NewQuery("buildbotBuild")
24 q = q.Eq("finished", finished) 24 q = q.Eq("finished", finished)
25 q = q.Eq("master", masterName) 25 q = q.Eq("master", masterName)
26 q = q.Eq("builder", builderName) 26 q = q.Eq("builder", builderName)
27 q = q.Limit(25) // TODO(hinoka): This should be adjustable
28 q = q.Order("-number") 27 q = q.Order("-number")
29 q.Finalize() 28 q.Finalize()
30 » buildbots := make([]*buildbotBuild, 0, 25) 29 » // Ignore the cursor, we don't need it.
31 » err := getBuildQueryBatcher(c).GetAll(c, q, &buildbots) 30 » buildbots, _, err := runBuildsQuery(c, q, 25)
32 return buildbots, err 31 return buildbots, err
33 } 32 }
34 33
35 // GetConsoleBuilds takes commits and builders and returns a matrix of 34 // GetConsoleBuilds takes commits and builders and returns a matrix of
36 // resp.ConsoleBuild objects. The expected format of the result 35 // resp.ConsoleBuild objects. The expected format of the result
37 // is [len(commits)][len(builders)]*resp.ConsoleBuild. The first level matches 36 // is [len(commits)][len(builders)]*resp.ConsoleBuild. The first level matches
38 // 1:1 to a commit, and the second level matches 1:1 to a builder. 37 // 1:1 to a commit, and the second level matches 1:1 to a builder.
39 func GetConsoleBuilds( 38 func GetConsoleBuilds(
40 c context.Context, builders []resp.BuilderRef, commits []string) ( 39 c context.Context, builders []resp.BuilderRef, commits []string) (
41 [][]*resp.ConsoleBuild, error) { 40 [][]*resp.ConsoleBuild, error) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 87 }
89 log.Debugf(c, 88 log.Debugf(c,
90 "Builder %s took %s to query, %s to comp ute.", builderName, 89 "Builder %s took %s to query, %s to comp ute.", builderName,
91 t2.Sub(t1), clock.Since(c, t2)) 90 t2.Sub(t1), clock.Since(c, t2))
92 return nil 91 return nil
93 } 92 }
94 } 93 }
95 }) 94 })
96 return results, err 95 return results, err
97 } 96 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698