[REV] add version delete interface,add some log to task engine

This commit is contained in:
bay1ts 2017-11-30 12:08:58 +08:00
parent 1ba297dcf5
commit 91b7c4d123
2 changed files with 12 additions and 10 deletions

View File

@ -219,15 +219,8 @@ func Status(task string) {
if strings.Contains(v.Status, "error")||strings.Contains(v.CompleStatus,"Failure")||strings.Contains(v.CompleStatus,"Unknow") {
checkFail+=1
//todo add continue ,code behind this line should be placed in line 254
fmt.Printf("task %s 's output \n",taskE.TaskID)
tb,_:=json.Marshal(taskE)
fmt.Println("task failed,details is %s",string(tb))
for _,v:=range taskE.Task.OutPut{
fmt.Println("on %s :\n %s",v.NodeID,v.Body)
}
os.Exit(1)
continue
}
continue
}else {
fmt.Printf("task %s is %s %s\n",task,v.Status,v.CompleStatus)
lastState=v.Status
@ -255,7 +248,13 @@ func Status(task string) {
}
checkFail=0
}
fmt.Printf("task %s 's output \n",taskE.TaskID)
tb,_:=json.Marshal(taskE)
fmt.Println("task failed,details is %s",string(tb))
for _,v:=range taskE.Task.OutPut{
fmt.Println("on %s :\n %s",v.NodeID,v.Body)
}
os.Exit(1)
}
func Task(c *cli.Context,task string,status bool) error {

View File

@ -433,6 +433,7 @@ func (t *TaskEngine) GetTask(taskID string) *model.Task {
task.Status = map[string]model.TaskStatus{}
task.Scheduler.Status=map[string]model.SchedulerStatus{}
OutPut:=[]*model.TaskOutPut{}
task.OutPut=OutPut
for _, n := range task.Nodes {
var taskState model.TaskStatus
@ -471,7 +472,7 @@ func (t *TaskEngine) GetTask(taskID string) *model.Task {
if schedulerRes.Count == 1 {
err=ffjson.Unmarshal(schedulerRes.Kvs[0].Value,&taskSchedulerStatus)
if err != nil {
logrus.Errorf("error get status,details %s",err.Error())
logrus.Errorf("error get scheduler,details %s",err.Error())
return nil
}
}
@ -765,6 +766,8 @@ func (t *TaskEngine) handleJobRecord(er *job.ExecutionRecord) {
//waitScheduleTask 等待调度条件成熟
func (t *TaskEngine) waitScheduleTask(taskSchedulerInfo *TaskSchedulerInfo, task *model.Task) {
sb,_:=json.Marshal(task.Scheduler.Status)
logrus.Infof("task scheduler is %s",string(sb))
//continueScheduler 是否继续调度,如果调度条件无法满足,停止调度
var continueScheduler = true
canRun := func() bool {