Browse Source

Merge pull request 'updated synctaskstatus' (#448) from tzwang/pcm-coordinator:master into master

pull/456/head
tzwang 8 months ago
parent
commit
2dd83fb8f2
2 changed files with 8 additions and 4 deletions
  1. +1
    -1
      internal/logic/core/tasklistlogic.go
  2. +7
    -3
      internal/scheduler/service/utils/status/taskStatusSync.go

+ 1
- 1
internal/logic/core/tasklistlogic.go View File

@@ -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)


+ 7
- 3
internal/scheduler/service/utils/status/taskStatusSync.go View File

@@ -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)


Loading…
Cancel
Save