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

Unified Diff: milo/appengine/swarming/build.go

Issue 2667363002: milo: Add a build info Swarming implementation. (Closed)
Patch Set: Created 3 years, 11 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/buildinfo/service.go ('k') | milo/appengine/swarming/buildinfo.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/swarming/build.go
diff --git a/milo/appengine/swarming/build.go b/milo/appengine/swarming/build.go
index 7c41c8d89694e610ea5782c0bd661f9d40810223..cf38a550233ece5fe750306111654c9429871fed 100644
--- a/milo/appengine/swarming/build.go
+++ b/milo/appengine/swarming/build.go
@@ -73,6 +73,7 @@ func getSwarmingClient(c context.Context, server string) (*swarming.Service, err
type swarmingService interface {
getHost() string
getSwarmingResult(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskResult, error)
+ getSwarmingRequest(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskRequest, error)
getTaskOutput(c context.Context, taskID string) (string, error)
}
@@ -106,7 +107,14 @@ func (svc *prodSwarmingService) getTaskOutput(c context.Context, taskID string)
return stdout.Output, nil
}
+func (svc *prodSwarmingService) getSwarmingRequest(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskRequest, error) {
+ return svc.client.Task.Request(taskID).Context(c).Do()
+}
+
type swarmingFetch struct {
+ fetchReq bool
+ req *swarming.SwarmingRpcsTaskRequest
+
fetchRes bool
res *swarming.SwarmingRpcsTaskResult
@@ -122,6 +130,13 @@ type swarmingFetch struct {
// errNotMiloJob.
func (f *swarmingFetch) get(c context.Context, svc swarmingService, taskID string) error {
err := parallel.FanOutIn(func(workC chan<- func() error) {
+ if f.fetchReq {
+ workC <- func() (err error) {
+ f.req, err = svc.getSwarmingRequest(c, taskID)
+ return
+ }
+ }
+
if f.fetchRes {
workC <- func() (err error) {
f.res, err = svc.getSwarmingResult(c, taskID)
@@ -142,6 +157,10 @@ func (f *swarmingFetch) get(c context.Context, svc swarmingService, taskID strin
// Current ACL implementation: error if this is not a Milo job.
switch {
+ case f.fetchReq:
+ if !isMiloJob(f.req.Tags) {
+ return errNotMiloJob
+ }
case f.fetchRes:
if !isMiloJob(f.res.Tags) {
return errNotMiloJob
« no previous file with comments | « milo/appengine/buildinfo/service.go ('k') | milo/appengine/swarming/buildinfo.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698