[FIX] Adjust the dependent task state judgment strategy and increase the dynamic change static task

This commit is contained in:
goodrain 2017-11-20 15:24:24 +08:00
parent e3ac05e3d3
commit a04047b5a0
5 changed files with 16 additions and 2 deletions

View File

@ -115,3 +115,9 @@ func DeleteTask(w http.ResponseWriter, r *http.Request) {
}
httputil.ReturnSuccess(r, w, nil)
}
//ReloadStaticTasks 重新加载静态文件
func ReloadStaticTasks(w http.ResponseWriter, r *http.Request) {
taskService.ReloadStaticTasks()
httputil.ReturnSuccess(r, w, nil)
}

View File

@ -105,6 +105,10 @@ func Routers(mode string) *chi.Mux {
})
}
})
//重新加载task文件
if mode == "master" {
r.Put("/-/taskreload", controller.ReloadStaticTasks)
}
return r
}

View File

@ -183,6 +183,11 @@ func (ts *TaskService) ExecTask(taskID string, nodes []string) *utils.APIHandleE
return nil
}
//ReloadStaticTasks reload task
func (ts *TaskService) ReloadStaticTasks() {
ts.ms.TaskEngine.LoadStaticTask()
}
//TaskTempService 任务模版
type TaskTempService struct {
SavePath string

View File

@ -149,7 +149,6 @@ func (n *NodeCluster) UpdateNode(node *model.HostNode) {
n.lock.Lock()
defer n.lock.Unlock()
n.nodes[node.ID] = node
logrus.Debugf("Update node %s info to etcd", node.ID)
n.client.Put(option.Config.NodePath+"/"+node.ID, node.String())
}
func (n *NodeCluster) getNodeFromKV(kv *mvccpb.KeyValue) *model.HostNode {

View File

@ -659,7 +659,7 @@ func (t *TaskEngine) waitScheduleTask(taskSchedulerInfo *TaskSchedulerInfo, task
if nodestatus, ok := depTask.Status[taskSchedulerInfo.Node]; ok && nodestatus.CompleStatus == "Success" {
result[i] = true
continue
} else if ok && nodestatus.CompleStatus != "Success" {
} else if ok && nodestatus.CompleStatus != "" {
taskSchedulerInfo.Status.Message = fmt.Sprintf("depend task %s Condition cannot be satisfied", depTask.ID)
taskSchedulerInfo.Status.Status = "Failure"
task.Scheduler.Status[taskSchedulerInfo.Node] = taskSchedulerInfo.Status