From d087fac9a397f586563f4149ec3a63c2ecbe586e Mon Sep 17 00:00:00 2001 From: tzwang Date: Fri, 14 Mar 2025 17:52:58 +0800 Subject: [PATCH] update syncreportmessage error msg --- internal/logic/core/tasklistlogic.go | 2 +- .../scheduler/service/utils/status/taskStatusSync.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/logic/core/tasklistlogic.go b/internal/logic/core/tasklistlogic.go index 82d7f072..25dbcfa3 100644 --- a/internal/logic/core/tasklistlogic.go +++ b/internal/logic/core/tasklistlogic.go @@ -59,7 +59,7 @@ func (l *TaskListLogic) TaskList(req *types.TaskListReq) (resp *types.TaskListRe // 更新智算任务状态 var ch = make(chan struct{}) - go l.updateAitaskStatus(tasks, ch) + //go l.updateAitaskStatus(tasks, ch) // 查询任务总数 l.svcCtx.DbEngin.Model(&models.Task{}).Count(&resp.TotalCount) diff --git a/internal/scheduler/service/utils/status/taskStatusSync.go b/internal/scheduler/service/utils/status/taskStatusSync.go index e90102e5..37047aff 100644 --- a/internal/scheduler/service/utils/status/taskStatusSync.go +++ b/internal/scheduler/service/utils/status/taskStatusSync.go @@ -144,9 +144,9 @@ func UpdateTaskStatus(svc *svc.ServiceContext, tasklist []*types.TaskModel) { } } - if count == len(aiTask) { - status = constants.Succeeded - } + //if count == len(aiTask) { + // status = constants.Succeeded + //} if status != "" { task.Status = status @@ -288,6 +288,8 @@ func updateInferTaskStatus(svc *svc.ServiceContext, task types.TaskModel) { } func UpdateAiTask(svc *svc.ServiceContext, aiTaskList ...*models.TaskAi) { + svc.Scheduler.AiService.TaskSyncLock.Lock() + defer svc.Scheduler.AiService.TaskSyncLock.Unlock() var wg sync.WaitGroup for _, aitask := range aiTaskList { t := aitask @@ -388,6 +390,8 @@ func UpdateAiTaskStatus(svc *svc.ServiceContext, tasklist []*types.TaskModel) { } func UpdateTrainingTaskStatus(svc *svc.ServiceContext, list []*types.AdapterInfo) { + svc.Scheduler.AiService.TaskSyncLock.Lock() + defer svc.Scheduler.AiService.TaskSyncLock.Unlock() var wg sync.WaitGroup for _, adapter := range list { taskList, err := svc.Scheduler.AiStorages.GetAiTasksByAdapterId(adapter.Id)