Browse Source

fix deployinstance status

Former-commit-id: 8e34db7011
pull/276/head
tzwang 1 year ago
parent
commit
1f868c58c4
4 changed files with 7 additions and 11 deletions
  1. +0
    -2
      internal/logic/inference/startdeployinstancelistlogic.go
  2. +0
    -2
      internal/logic/inference/stopdeployinstancelogic.go
  3. +4
    -2
      internal/scheduler/database/aiStorage.go
  4. +3
    -5
      internal/scheduler/service/updater/deployInstance.go

+ 0
- 2
internal/logic/inference/startdeployinstancelistlogic.go View File

@@ -33,8 +33,6 @@ func (l *StartDeployInstanceListLogic) StartDeployInstanceList(req *types.StartD
return nil, err
}

l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins)

success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StartInferDeployInstance(l.ctx, req.InstanceId)
if !success {
return nil, errors.New("start instance failed")


+ 0
- 2
internal/logic/inference/stopdeployinstancelogic.go View File

@@ -33,8 +33,6 @@ func (l *StopDeployInstanceLogic) StopDeployInstance(req *types.StopDeployInstan
return nil, err
}

l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins)

success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StopInferDeployInstance(l.ctx, req.InstanceId)
if !success {
return nil, errors.New("stop instance failed")


+ 4
- 2
internal/scheduler/database/aiStorage.go View File

@@ -399,8 +399,10 @@ func (s *AiStorage) SaveInferDeployInstance(instanceId string, instanceName stri
return insModel.Id, nil
}

func (s *AiStorage) UpdateInferDeployInstance(instance *models.AiInferDeployInstance) error {
instance.UpdateTime = time.Now().Format(time.RFC3339)
func (s *AiStorage) UpdateInferDeployInstance(instance *models.AiInferDeployInstance, needUpdateTime bool) error {
if needUpdateTime {
instance.UpdateTime = time.Now().Format(time.RFC3339)
}
tx := s.DbEngin.Table("ai_infer_deploy_instance").Updates(instance)
if tx.Error != nil {
logx.Errorf(tx.Error.Error())


+ 3
- 5
internal/scheduler/service/updater/deployInstance.go View File

@@ -71,10 +71,8 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe
}
}

if updatetime {
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance)
if err != nil {
return
}
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance, updatetime)
if err != nil {
return
}
}

Loading…
Cancel
Save