2021-04-05 11:13:21 +02:00
|
|
|
package job
|
|
|
|
|
2021-04-10 12:19:32 +02:00
|
|
|
//State Indicate the state of the Job
|
2021-04-05 11:13:21 +02:00
|
|
|
type State int64
|
|
|
|
|
|
|
|
const (
|
2021-04-10 12:19:32 +02:00
|
|
|
// NEW Job has just been created and hasn't started yet
|
2021-04-05 11:13:21 +02:00
|
|
|
NEW State = iota
|
2021-04-10 12:19:32 +02:00
|
|
|
// RUNNING Job started and is running.
|
2021-04-05 11:13:21 +02:00
|
|
|
RUNNING
|
2021-04-10 12:19:32 +02:00
|
|
|
// FINISHED Job started and finished processing.
|
2021-04-05 11:13:21 +02:00
|
|
|
FINISHED
|
2021-04-10 12:19:32 +02:00
|
|
|
// PANICKED Job started and finished but encountered a panic.
|
2021-04-05 11:13:21 +02:00
|
|
|
PANICKED
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s State) String() string {
|
|
|
|
switch s {
|
|
|
|
case NEW:
|
|
|
|
return "NEW"
|
|
|
|
case RUNNING:
|
|
|
|
return "RUNNING"
|
|
|
|
case FINISHED:
|
|
|
|
return "FINISHED"
|
|
|
|
case PANICKED:
|
|
|
|
return "PANICKED"
|
|
|
|
default:
|
|
|
|
return "UNKNOWN"
|
|
|
|
}
|
|
|
|
}
|