diff --git a/backend/services/task.go b/backend/services/task.go index 53c96b6b..216bdfb7 100644 --- a/backend/services/task.go +++ b/backend/services/task.go @@ -447,6 +447,8 @@ func CancelTask(id string) (err error) { // 获取任务 task, err := model.GetTask(id) if err != nil { + log.Errorf("task not found, task id : %s, error: %s", id, err.Error()) + debug.PrintStack() return err } @@ -458,6 +460,8 @@ func CancelTask(id string) (err error) { // 获取当前节点(默认当前节点为主节点) node, err := GetCurrentNode() if err != nil { + log.Errorf("get current node error: %s", err.Error()) + debug.PrintStack() return err } @@ -466,9 +470,13 @@ func CancelTask(id string) (err error) { // 获取任务执行频道 ch := utils.TaskExecChanMap.ChanBlocked(id) + if ch != nil { + // 发出取消进程信号 + ch <- constants.TaskCancel + } else { + model. + } - // 发出取消进程信号 - ch <- constants.TaskCancel } else { // 任务节点为工作节点 diff --git a/frontend/src/store/modules/task.js b/frontend/src/store/modules/task.js index 1d7e6c09..bb182706 100644 --- a/frontend/src/store/modules/task.js +++ b/frontend/src/store/modules/task.js @@ -139,7 +139,7 @@ const actions = { cancelTask ({ state, dispatch }, id) { return request.post(`/tasks/${id}/cancel`) .then(() => { - dispatch('getTaskData') + dispatch('getTaskData', id) }) } }