[REV] optimize grctl task depends command;optimize install process

This commit is contained in:
bay1ts 2017-12-11 09:47:47 +08:00
parent 9479528c9d
commit 10b7c4ea17

View File

@ -200,6 +200,8 @@ func Status(task string,nodes []string) {
for _, v := range nodes {
set[v] = true
}
fmt.Printf("%s task is start\n",task)
lastState="Start"
for checkFail<3 {
time.Sleep(3*time.Second)
taskE,err:=clients.NodeClient.Tasks().Get(task)
@ -217,10 +219,9 @@ func Status(task string,nodes []string) {
for k,v:=range status.Status{
//不是当前任务需要检测的status
if !set[k] {
logrus.Infof("task %s can't run in %s",task,k)
fmt.Print("..")
continue
}
logrus.Infof("task %s status is %v,final status is %s",task,v.Status,v.CompleStatus)
if strings.Contains(v.Status, "error")||strings.Contains(v.CompleStatus,"Failure")||strings.Contains(v.CompleStatus,"Unknow") {
checkFail+=1
fmt.Errorf("error executing task %s",task)
@ -238,6 +239,12 @@ func Status(task string,nodes []string) {
}
os.Exit(1)
}
if lastState!=v.Status{
fmt.Printf("task %s is %s\n",task,v.Status)
}else{
fmt.Print("..")
}
lastState=v.Status
if v.Status=="complete"||v.CompleStatus=="Success"{
fmt.Printf("task %s is %s %s\n",task,v.Status,v.CompleStatus)
lastState=v.Status
@ -270,14 +277,6 @@ func Status(task string,nodes []string) {
}
}
return
}else{
logrus.Infof("latest state is %s ,now task status is %s",lastState,v.Status)
if lastState!=v.Status{
fmt.Printf("task %s is %s\n",task,v.Status)
}else{
fmt.Print("..")
}
lastState=v.Status
}
}