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

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

Issue 2667363002: milo: Add a build info Swarming implementation. (Closed)
Patch Set: Comments. Created 3 years, 10 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 e34a90a323c52e722fea067065c14c3ae088daea..df4ba5e6e3dbe8a18c8eec9bca0c9f9574648ea5 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,12 +107,18 @@ 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 swarmingFetchParams struct {
+ fetchReq bool
fetchRes bool
fetchLog bool
}
type swarmingFetchResult struct {
+ req *swarming.SwarmingRpcsTaskRequest
res *swarming.SwarmingRpcsTaskResult
log string
}
@@ -134,6 +141,13 @@ func swarmingFetch(c context.Context, svc swarmingService, taskID string, req sw
var fr swarmingFetchResult
err := parallel.FanOutIn(func(workC chan<- func() error) {
+ if req.fetchReq {
+ workC <- func() (err error) {
+ fr.req, err = svc.getSwarmingRequest(c, taskID)
+ return
+ }
+ }
+
if req.fetchRes {
workC <- func() (err error) {
fr.res, err = svc.getSwarmingResult(c, taskID)
@@ -154,6 +168,10 @@ func swarmingFetch(c context.Context, svc swarmingService, taskID string, req sw
// Current ACL implementation: error if this is not a Milo job.
switch {
+ case req.fetchReq:
+ if !isMiloJob(fr.req.Tags) {
+ return nil, errNotMiloJob
+ }
case req.fetchRes:
if !isMiloJob(fr.res.Tags) {
return nil, 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