| @@ -278,7 +278,8 @@ func (as *AiScheduler) handleErrors(errs []interface{}, clusters []*strategy.Ass | |||||
| } | } | ||||
| //report msg | //report msg | ||||
| report := &jcs.TrainReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.TrainReportMessage{ | |||||
| Type: "Train", | Type: "Train", | ||||
| TaskName: "", | TaskName: "", | ||||
| TaskID: strconv.FormatInt(taskId, 10), | TaskID: strconv.FormatInt(taskId, 10), | ||||
| @@ -287,7 +288,7 @@ func (as *AiScheduler) handleErrors(errs []interface{}, clusters []*strategy.Ass | |||||
| ClusterID: e.clusterId, | ClusterID: e.clusterId, | ||||
| Output: "", | Output: "", | ||||
| } | } | ||||
| report.Report = reportMsg | |||||
| //report status | //report status | ||||
| _ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | _ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | ||||
| @@ -315,7 +316,8 @@ func (as *AiScheduler) handleErrors(errs []interface{}, clusters []*strategy.Ass | |||||
| } | } | ||||
| } | } | ||||
| //add report msg | //add report msg | ||||
| report := &jcs.TrainReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.TrainReportMessage{ | |||||
| Type: "Train", | Type: "Train", | ||||
| TaskName: "", | TaskName: "", | ||||
| TaskID: strconv.FormatInt(taskId, 10), | TaskID: strconv.FormatInt(taskId, 10), | ||||
| @@ -324,6 +326,7 @@ func (as *AiScheduler) handleErrors(errs []interface{}, clusters []*strategy.Ass | |||||
| ClusterID: s.ClusterId, | ClusterID: s.ClusterId, | ||||
| Output: "", | Output: "", | ||||
| } | } | ||||
| report.Report = reportMsg | |||||
| //report status | //report status | ||||
| _ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | _ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | ||||
| } | } | ||||
| @@ -10,9 +10,7 @@ import ( | |||||
| ) | ) | ||||
| type JobStatusReportReq struct { | type JobStatusReportReq struct { | ||||
| TaskName string `json:"taskName"` | |||||
| TaskID string `json:"taskID"` | |||||
| Messages []interface{} `json:"messages"` | |||||
| Report interface{} `json:"report"` | |||||
| } | } | ||||
| type TrainReportMessage struct { | type TrainReportMessage struct { | ||||
| Type string `json:"type"` | Type string `json:"type"` | ||||
| @@ -44,7 +42,7 @@ func StatusReport(url string, report interface{}) error { | |||||
| rp, err := req. | rp, err := req. | ||||
| SetHeader("Content-Type", "application/json"). | SetHeader("Content-Type", "application/json"). | ||||
| SetBody(report). | SetBody(report). | ||||
| SetResult(&resp). | |||||
| SetResult(resp). | |||||
| Post(url) | Post(url) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -14,7 +14,8 @@ import ( | |||||
| ) | ) | ||||
| func reportHpcStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, hpcTask *models.TaskHpc, status bool, message string) error { | func reportHpcStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, hpcTask *models.TaskHpc, status bool, message string) error { | ||||
| report := &jcs.TrainReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.TrainReportMessage{ | |||||
| Type: "Train", | Type: "Train", | ||||
| TaskName: task.Name, | TaskName: task.Name, | ||||
| TaskID: strconv.FormatInt(task.Id, 10), | TaskID: strconv.FormatInt(task.Id, 10), | ||||
| @@ -23,6 +24,7 @@ func reportHpcStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, hpc | |||||
| ClusterID: strconv.FormatInt(hpcTask.ClusterId, 10), | ClusterID: strconv.FormatInt(hpcTask.ClusterId, 10), | ||||
| Output: hpcTask.WorkDir, | Output: hpcTask.WorkDir, | ||||
| } | } | ||||
| report.Report = reportMsg | |||||
| marshal, _ := jsoniter.MarshalToString(report) | marshal, _ := jsoniter.MarshalToString(report) | ||||
| log.Debug().Msgf("通知中间件任务状态参数: [%v]", marshal) | log.Debug().Msgf("通知中间件任务状态参数: [%v]", marshal) | ||||
| @@ -192,7 +192,8 @@ func (s *TaskStatus) updateAiTask(aiTaskList []*models.TaskAi) { | |||||
| } | } | ||||
| func (s *TaskStatus) reportStatusMessages(task *types.TaskModel, aiTask *models.TaskAi) error { | func (s *TaskStatus) reportStatusMessages(task *types.TaskModel, aiTask *models.TaskAi) error { | ||||
| report := &jcs.TrainReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.TrainReportMessage{ | |||||
| Type: "Train", | Type: "Train", | ||||
| TaskName: task.Name, | TaskName: task.Name, | ||||
| TaskID: strconv.FormatInt(task.Id, 10), | TaskID: strconv.FormatInt(task.Id, 10), | ||||
| @@ -206,10 +207,12 @@ func (s *TaskStatus) reportStatusMessages(task *types.TaskModel, aiTask *models. | |||||
| output = aiTask.Output | output = aiTask.Output | ||||
| } | } | ||||
| report.Status = true | |||||
| report.Message = "" | |||||
| report.ClusterID = strconv.FormatInt(aiTask.ClusterId, 10) | |||||
| report.Output = output | |||||
| reportMsg.Status = true | |||||
| reportMsg.Message = "" | |||||
| reportMsg.ClusterID = strconv.FormatInt(aiTask.ClusterId, 10) | |||||
| reportMsg.Output = output | |||||
| report.Report = reportMsg | |||||
| err := jcs.StatusReport(s.config.JcsMiddleware.JobStatusReportUrl, report) | err := jcs.StatusReport(s.config.JcsMiddleware.JobStatusReportUrl, report) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -224,7 +227,8 @@ func (s *TaskStatus) reportStatusMessages(task *types.TaskModel, aiTask *models. | |||||
| } | } | ||||
| func ReportStatus(svc *svc.ServiceContext, taskName string, taskId string, clusterId string, url string, status bool, msg string) error { | func ReportStatus(svc *svc.ServiceContext, taskName string, taskId string, clusterId string, url string, status bool, msg string) error { | ||||
| report := &jcs.InferReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.InferReportMessage{ | |||||
| Type: "Inference", | Type: "Inference", | ||||
| TaskName: taskName, | TaskName: taskName, | ||||
| TaskID: taskId, | TaskID: taskId, | ||||
| @@ -233,6 +237,7 @@ func ReportStatus(svc *svc.ServiceContext, taskName string, taskId string, clust | |||||
| ClusterID: clusterId, | ClusterID: clusterId, | ||||
| Url: url, | Url: url, | ||||
| } | } | ||||
| report.Report = reportMsg | |||||
| err := jcs.StatusReport(svc.Scheduler.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | err := jcs.StatusReport(svc.Scheduler.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -166,7 +166,8 @@ func UpdateTaskStatus(svc *svc.ServiceContext, tasklist []*types.TaskModel) { | |||||
| } | } | ||||
| func reportStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, aiTask *models.TaskAi) error { | func reportStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, aiTask *models.TaskAi) error { | ||||
| report := &jcs.TrainReportMessage{ | |||||
| report := &jcs.JobStatusReportReq{} | |||||
| reportMsg := &jcs.TrainReportMessage{ | |||||
| Type: "Train", | Type: "Train", | ||||
| TaskName: task.Name, | TaskName: task.Name, | ||||
| TaskID: strconv.FormatInt(task.Id, 10), | TaskID: strconv.FormatInt(task.Id, 10), | ||||
| @@ -180,10 +181,11 @@ func reportStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, aiTask | |||||
| output = aiTask.Output | output = aiTask.Output | ||||
| } | } | ||||
| report.Status = true | |||||
| report.Message = "" | |||||
| report.ClusterID = strconv.FormatInt(aiTask.ClusterId, 10) | |||||
| report.Output = output | |||||
| reportMsg.Status = true | |||||
| reportMsg.Message = "" | |||||
| reportMsg.ClusterID = strconv.FormatInt(aiTask.ClusterId, 10) | |||||
| reportMsg.Output = output | |||||
| report.Report = reportMsg | |||||
| err := jcs.StatusReport(svc.Scheduler.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | err := jcs.StatusReport(svc.Scheduler.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report) | ||||
| if err != nil { | if err != nil { | ||||