-
Notifications
You must be signed in to change notification settings - Fork 21
/
info.go
45 lines (40 loc) · 2.12 KB
/
info.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
package core
import (
"github.com/MG-RAST/AWE/lib/conf"
"time"
)
//job info
type Info struct {
Name string `bson:"name" json:"name" mapstructure:"name"`
Xref string `bson:"xref" json:"xref" mapstructure:"xref"`
Service string `bson:"service" json:"service" mapstructure:"service"`
Project string `bson:"project" json:"project" mapstructure:"project"`
User string `bson:"user" json:"user" mapstructure:"user"`
Pipeline string `bson:"pipeline" json:"pipeline" mapstructure:"pipeline"` // or workflow
ClientGroups string `bson:"clientgroups" json:"clientgroups" mapstructure:"clientgroups"`
SubmitTime time.Time `bson:"submittime" json:"submittime" mapstructure:"submittime"`
StartedTime time.Time `bson:"startedtime" json:"startedtime" mapstructure:"startedtime"`
CompletedTime time.Time `bson:"completedtime" json:"completedtime" mapstructure:"completedtime"`
Priority int `bson:"priority" json:"priority" mapstructure:"priority"`
Auth bool `bson:"auth" json:"auth" mapstructure:"auth"`
DataToken string `bson:"datatoken" json:"-" mapstructure:"-"`
NoRetry bool `bson:"noretry" json:"noretry" mapstructure:"noretry"`
UserAttr map[string]interface{} `bson:"userattr" json:"userattr" mapstructure:"userattr"`
Description string `bson:"description" json:"description" mapstructure:"description"`
Tracking bool `bson:"tracking" json:"tracking" mapstructure:"tracking"`
StartAt time.Time `bson:"start_at" json:"start_at" mapstructure:"start_at"` // will start tasks at this timepoint or shortly after
}
func NewInfo() *Info {
return &Info{
SubmitTime: time.Now(),
Priority: conf.BasePriority,
}
}
func (this *Info) SetStartedTime(jobid string, t time.Time) (err error) {
err = DbUpdateJobField(jobid, "info.startedtime", t)
if err != nil {
return
}
this.StartedTime = t
return
}