-
Notifications
You must be signed in to change notification settings - Fork 71
/
task.go
56 lines (47 loc) · 1.63 KB
/
task.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2019 Baidu Inc. All rights reserved
// Use of this source code is governed by a CCE
// license that can be found in the LICENSE file.
/*
modification history
--------------------
2021/06/24 16:00:00, by pansiyuan02@baidu.com, create
*/
package types
import "time"
const (
TaskTypeInstanceGroupReplicas TaskType = "InstanceGroupReplicas"
)
const (
TaskPhasePending TaskPhase = "Pending"
TaskPhaseProcessing TaskPhase = "Processing"
TaskPhaseDone TaskPhase = "Done"
TaskPhaseAborted TaskPhase = "Aborted"
)
const (
TaskProcessPhasePending TaskProcessPhase = "Pending"
TaskProcessPhaseProcessing TaskProcessPhase = "Processing"
TaskProcessPhaseDone TaskProcessPhase = "Done"
TaskProcessPhaseAborted TaskProcessPhase = "Aborted"
)
type TaskType string
type TaskPhase string
type TaskProcessPhase string
type Task struct {
ID string `json:"id"`
Type TaskType `json:"type"`
Description string `json:"description"`
StartTime time.Time `json:"startTime"`
FinishTime *time.Time `json:"finishTime,omitempty"`
Phase TaskPhase `json:"phase"`
TaskProcesses []TaskProcess `json:"processes,omitempty"`
ErrMessage string `json:"errMessage,omitempty"`
}
type TaskProcess struct {
Name string `json:"name"`
Phase TaskProcessPhase `json:"phase,omitempty"`
StartTime *time.Time `json:"startTime,omitempty"`
FinishTime *time.Time `json:"finishTime,omitempty"`
Metrics map[string]string `json:"metrics,omitempty"`
SubProcesses []TaskProcess `json:"subProcesses,omitempty"`
ErrMessage string `json:"errMessage,omitempty"`
}