summaryrefslogtreecommitdiff
path: root/internal/task/task.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/task/task.go')
-rw-r--r--internal/task/task.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/task/task.go b/internal/task/task.go
index d360a07..3e74a82 100644
--- a/internal/task/task.go
+++ b/internal/task/task.go
@@ -8,6 +8,7 @@ const (
StatePending State = "PENDING"
StateQueued State = "QUEUED"
StateRunning State = "RUNNING"
+ StateReady State = "READY"
StateCompleted State = "COMPLETED"
StateFailed State = "FAILED"
StateTimedOut State = "TIMED_OUT"
@@ -53,9 +54,10 @@ type Task struct {
Priority Priority `yaml:"priority" json:"priority"`
Tags []string `yaml:"tags" json:"tags"`
DependsOn []string `yaml:"depends_on" json:"depends_on"`
- State State `yaml:"-" json:"state"`
- CreatedAt time.Time `yaml:"-" json:"created_at"`
- UpdatedAt time.Time `yaml:"-" json:"updated_at"`
+ State State `yaml:"-" json:"state"`
+ RejectionComment string `yaml:"-" json:"rejection_comment,omitempty"`
+ CreatedAt time.Time `yaml:"-" json:"created_at"`
+ UpdatedAt time.Time `yaml:"-" json:"updated_at"`
}
// Duration wraps time.Duration for YAML unmarshaling from strings like "30m".
@@ -90,7 +92,8 @@ func ValidTransition(from, to State) bool {
transitions := map[State][]State{
StatePending: {StateQueued, StateCancelled},
StateQueued: {StateRunning, StateCancelled},
- StateRunning: {StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded},
+ StateRunning: {StateReady, StateCompleted, StateFailed, StateTimedOut, StateCancelled, StateBudgetExceeded},
+ StateReady: {StateCompleted, StatePending},
StateFailed: {StateQueued}, // retry
StateTimedOut: {StateQueued}, // retry
}