Browse Source

check task status sync

pull/458/head
tzwang 7 months ago
parent
commit
d7dee070d7
2 changed files with 20 additions and 0 deletions
  1. +16
    -0
      internal/scheduler/service/utils/jcs/middleware.go
  2. +4
    -0
      internal/scheduler/service/utils/status/taskStatusSync.go

+ 16
- 0
internal/scheduler/service/utils/jcs/middleware.go View File

@@ -1,7 +1,10 @@
package jcs

import (
"encoding/json"
"github.com/zeromicro/go-zero/core/logx"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/database"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
"gitlink.org.cn/JointCloud/pcm-openi/common"
)

@@ -41,3 +44,16 @@ func StatusReport(url string, report *JobStatusReportReq) error {

return nil
}

func TempSaveReportToTask(store *database.AiStorage, task *types.TaskModel, report *JobStatusReportReq) error {
jsonBytes, err := json.Marshal(report)

task.Result = string(jsonBytes)

err = store.UpdateTask(task)
if err != nil {
return err
}

return nil
}

+ 4
- 0
internal/scheduler/service/utils/status/taskStatusSync.go View File

@@ -190,6 +190,10 @@ func reportStatusMessages(svc *svc.ServiceContext, task *types.TaskModel, aiTask

_ = jcs.StatusReport(svc.Scheduler.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report)

err := jcs.TempSaveReportToTask(svc.Scheduler.AiStorages, task, report)
if err != nil {
return err
}
return nil
}



Loading…
Cancel
Save