| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package mutate | 5 package mutate |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "github.com/luci/gae/filter/txnBuf" | 10 "github.com/luci/gae/filter/txnBuf" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 eid := dm.NewExecutionID(s.For.Quest, s.For.Id, a.CurExecution) | 75 eid := dm.NewExecutionID(s.For.Quest, s.For.Id, a.CurExecution) |
| 76 e := model.MakeExecution(c, eid, q.Desc.DistributorConfigName, ver) | 76 e := model.MakeExecution(c, eid, q.Desc.DistributorConfigName, ver) |
| 77 e.TimeToStart = q.Desc.Meta.Timeouts.Start.Duration() | 77 e.TimeToStart = q.Desc.Meta.Timeouts.Start.Duration() |
| 78 e.TimeToRun = q.Desc.Meta.Timeouts.Run.Duration() | 78 e.TimeToRun = q.Desc.Meta.Timeouts.Run.Duration() |
| 79 | 79 |
| 80 exAuth := &dm.Execution_Auth{Id: eid, Token: e.Token} | 80 exAuth := &dm.Execution_Auth{Id: eid, Token: e.Token} |
| 81 | 81 |
| 82 var distTok distributor.Token | 82 var distTok distributor.Token |
| 83 » distTok, e.TimeToStop, err = dist.Run( | 83 » distTok, e.TimeToStop, err = dist.Run(&q.Desc, exAuth, prevResult) |
| 84 » » distributor.NewTaskDescription(c, &q.Desc, exAuth, prevResult)) | |
| 85 if e.TimeToStop <= 0 { | 84 if e.TimeToStop <= 0 { |
| 86 e.TimeToStop = q.Desc.Meta.Timeouts.Stop.Duration() | 85 e.TimeToStop = q.Desc.Meta.Timeouts.Stop.Duration() |
| 87 } | 86 } |
| 88 e.DistributorToken = string(distTok) | 87 e.DistributorToken = string(distTok) |
| 89 if err != nil { | 88 if err != nil { |
| 90 if errors.IsTransient(err) { | 89 if errors.IsTransient(err) { |
| 91 // tumble will retry us later | 90 // tumble will retry us later |
| 92 logging.WithError(err).Errorf(c, "got transient error in
ScheduleExecution") | 91 logging.WithError(err).Errorf(c, "got transient error in
ScheduleExecution") |
| 93 return | 92 return |
| 94 } | 93 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 115 if err = ds.Put(a, e); err != nil { | 114 if err = ds.Put(a, e); err != nil { |
| 116 logging.WithError(err).Errorf(c, "putting attempt+execution") | 115 logging.WithError(err).Errorf(c, "putting attempt+execution") |
| 117 } | 116 } |
| 118 | 117 |
| 119 return | 118 return |
| 120 } | 119 } |
| 121 | 120 |
| 122 func init() { | 121 func init() { |
| 123 tumble.Register((*ScheduleExecution)(nil)) | 122 tumble.Register((*ScheduleExecution)(nil)) |
| 124 } | 123 } |
| OLD | NEW |