| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 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 presentation | 5 package presentation |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| 11 | 11 |
| 12 "github.com/luci/luci-go/common/logging" | 12 "github.com/luci/luci-go/common/logging" |
| 13 "github.com/luci/luci-go/scheduler/appengine/catalog" | 13 "github.com/luci/luci-go/scheduler/appengine/catalog" |
| 14 "github.com/luci/luci-go/scheduler/appengine/engine" | 14 "github.com/luci/luci-go/scheduler/appengine/engine" |
| 15 "github.com/luci/luci-go/scheduler/appengine/task" | 15 "github.com/luci/luci-go/scheduler/appengine/task" |
| 16 ) | 16 ) |
| 17 | 17 |
| 18 // PublicStateKind defines state of the job which is exposed in UI and API | 18 // PublicStateKind defines state of the job which is exposed in UI and API |
| 19 // instead of internal engine.StateKind which is kept as an implementation | 19 // instead of internal engine.StateKind which is kept as an implementation |
| 20 // detail. | 20 // detail. |
| 21 type PublicStateKind string | 21 type PublicStateKind string |
| 22 | 22 |
| 23 // When a PublicStateKind is added/removed/updated, update scheduler api proto |
| 24 // doc for `JobState`. |
| 23 const ( | 25 const ( |
| 24 PublicStateDisabled PublicStateKind = "DISABLED" | 26 PublicStateDisabled PublicStateKind = "DISABLED" |
| 25 PublicStateOverrun PublicStateKind = "OVERRUN" | 27 PublicStateOverrun PublicStateKind = "OVERRUN" |
| 26 PublicStatePaused PublicStateKind = "PAUSED" | 28 PublicStatePaused PublicStateKind = "PAUSED" |
| 27 PublicStateRetrying PublicStateKind = "RETRYING" | 29 PublicStateRetrying PublicStateKind = "RETRYING" |
| 28 PublicStateRunning PublicStateKind = "RUNNING" | 30 PublicStateRunning PublicStateKind = "RUNNING" |
| 29 PublicStateScheduled PublicStateKind = "SCHEDULED" | 31 PublicStateScheduled PublicStateKind = "SCHEDULED" |
| 30 PublicStateStarting PublicStateKind = "STARTING" | 32 PublicStateStarting PublicStateKind = "STARTING" |
| 31 PublicStateSuspended PublicStateKind = "SUSPENDED" | 33 PublicStateSuspended PublicStateKind = "SUSPENDED" |
| 32 PublicStateWaiting PublicStateKind = "WAITING" | 34 PublicStateWaiting PublicStateKind = "WAITING" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 taskDef, err := cat.UnmarshalTask(j.Task) | 90 taskDef, err := cat.UnmarshalTask(j.Task) |
| 89 if err != nil { | 91 if err != nil { |
| 90 logging.WithError(err).Warningf(ctx, "Failed to unmarshal task p
roto for %s", j.JobID) | 92 logging.WithError(err).Warningf(ctx, "Failed to unmarshal task p
roto for %s", j.JobID) |
| 91 return task.Traits{}, err | 93 return task.Traits{}, err |
| 92 } | 94 } |
| 93 if manager := cat.GetTaskManager(taskDef); manager != nil { | 95 if manager := cat.GetTaskManager(taskDef); manager != nil { |
| 94 return manager.Traits(), nil | 96 return manager.Traits(), nil |
| 95 } | 97 } |
| 96 return task.Traits{}, nil | 98 return task.Traits{}, nil |
| 97 } | 99 } |
| OLD | NEW |