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

Unified Diff: appengine/cmd/dm/mutate/finish_attempt.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: self review Created 4 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
Index: appengine/cmd/dm/mutate/finish_attempt.go
diff --git a/appengine/cmd/dm/mutate/finish_attempt.go b/appengine/cmd/dm/mutate/finish_attempt.go
index 1b52e8972a4d6cc1b7f06d453a3a0bfeb42a8f9e..b2f4133aef4afb3eb187775c62e305ccabeeb145 100644
--- a/appengine/cmd/dm/mutate/finish_attempt.go
+++ b/appengine/cmd/dm/mutate/finish_attempt.go
@@ -30,7 +30,7 @@ type FinishAttempt struct {
// Root implements tumble.Mutation
func (f *FinishAttempt) Root(c context.Context) *datastore.Key {
- return datastore.Get(c).KeyForObj(&model.Attempt{ID: *f.Auth.Id.AttemptID()})
+ return model.AttemptKeyFromID(c, f.Auth.Id.AttemptID())
}
// RollForward implements tumble.Mutation
@@ -38,16 +38,16 @@ func (f *FinishAttempt) Root(c context.Context) *datastore.Key {
// This mutation is called directly from FinishAttempt, so we use
// grpcutil.MaybeLogErr
func (f *FinishAttempt) RollForward(c context.Context) (muts []tumble.Mutation, err error) {
- atmpt, _, err := model.InvalidateExecution(c, f.Auth)
+ atmpt, ex, err := model.InvalidateExecution(c, f.Auth)
if err != nil {
return
}
- ds := datastore.Get(c)
+ if err = ResetExecutionTimeout(c, ex); err != nil {
+ return
+ }
- // Executing -> Finished is valid, and we know we're already Executing because
- // the InvalidateExecution call above asserts that or errors out.
- atmpt.MustModifyState(c, dm.Attempt_FINISHED)
+ ds := datastore.Get(c)
atmpt.ResultSize = uint32(len(f.Result))
atmpt.ResultExpiration = f.ResultExpiration
@@ -61,10 +61,6 @@ func (f *FinishAttempt) RollForward(c context.Context) (muts []tumble.Mutation,
err = grpcutil.MaybeLogErr(c, ds.PutMulti([]interface{}{atmpt, rslt}),
codes.Internal, "while trying to PutMulti")
- // TODO(iannucci): also include mutations to generate index entries for
- // the attempt results.
- muts = append(muts, &RecordCompletion{For: f.Auth.Id.AttemptID()})
-
return
}

Powered by Google App Engine
This is Rietveld 408576698