Commit 03c1cc46 authored by duanjinfei's avatar duanjinfei

add task exec error handler

parent da3d27b4
...@@ -375,6 +375,7 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage) ...@@ -375,6 +375,7 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
log.Error("Container resp output is nil") log.Error("Container resp output is nil")
taskExecResult.TaskExecError = fmt.Sprintf("worker:%s,%s", conf.GetConfig().SignPublicAddress.Hex(), "Container resp output is nil") taskExecResult.TaskExecError = fmt.Sprintf("worker:%s,%s", conf.GetConfig().SignPublicAddress.Hex(), "Container resp output is nil")
t.ExecTaskIdIsSuccess.Store(taskMsg.TaskId, true) t.ExecTaskIdIsSuccess.Store(taskMsg.TaskId, true)
taskExecResult.TaskRespBody = readBody
return return
} }
} }
...@@ -662,7 +663,7 @@ func parseData(readBody []byte) interface{} { ...@@ -662,7 +663,7 @@ func parseData(readBody []byte) interface{} {
log.WithError(err).Error("Parse json raw message failed") log.WithError(err).Error("Parse json raw message failed")
return bytes.NewBuffer(readBody).String() return bytes.NewBuffer(readBody).String()
} }
if m["output"] == nil { if m["output"] == nil || len(m["output"]) == 0 {
log.WithField("output", nil).Warn("The container resp") log.WithField("output", nil).Warn("The container resp")
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment