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

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

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: fix imports and make dummy.go a real file 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
« no previous file with comments | « appengine/cmd/dm/mutate/ack_fwd_dep_test.go ('k') | appengine/cmd/dm/mutate/add_backdep.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/dm/mutate/activate_execution.go
diff --git a/appengine/cmd/dm/mutate/activate_execution.go b/appengine/cmd/dm/mutate/activate_execution.go
new file mode 100644
index 0000000000000000000000000000000000000000..3dcc93040af6b395cac9bc1ee03ac92c9491bec9
--- /dev/null
+++ b/appengine/cmd/dm/mutate/activate_execution.go
@@ -0,0 +1,39 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package mutate
+
+import (
+ "golang.org/x/net/context"
+
+ "github.com/luci/gae/service/datastore"
+ "github.com/luci/luci-go/appengine/cmd/dm/model"
+ "github.com/luci/luci-go/appengine/tumble"
+ "github.com/luci/luci-go/common/api/dm/service/v1"
+)
+
+// ActivateExecution executes an execution, moving it from the
+// SCHEDULING->RUNNING state, and resetting the execution timeout (if any).
+type ActivateExecution struct {
+ Auth *dm.Execution_Auth
+ NewTok []byte
+}
+
+// Root implements tumble.Mutation.
+func (a *ActivateExecution) Root(c context.Context) *datastore.Key {
+ return model.AttemptKeyFromID(c, a.Auth.Id.AttemptID())
+}
+
+// RollForward implements tumble.Mutation
+func (a *ActivateExecution) RollForward(c context.Context) (muts []tumble.Mutation, err error) {
+ _, e, err := model.ActivateExecution(c, a.Auth, a.NewTok)
+ if err == nil {
+ err = ResetExecutionTimeout(c, e)
+ }
+ return
+}
+
+func init() {
+ tumble.Register((*ActivateExecution)(nil))
+}
« no previous file with comments | « appengine/cmd/dm/mutate/ack_fwd_dep_test.go ('k') | appengine/cmd/dm/mutate/add_backdep.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698