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

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: 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/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..1accd7c5d5709dd4cc7c2658180c31b6b6b66909
--- /dev/null
+++ b/appengine/cmd/dm/mutate/activate_execution.go
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license 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 executions an execution, moving it from the
dnj (Google) 2016/06/09 18:00:56 nit: executions an execution!
iannucci 2016/06/15 00:46:01 Done.
+// 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))
+}

Powered by Google App Engine
This is Rietveld 408576698