Merge pull request 'fix deployinstance logics' (#276) from tzwang/pcm-coordinator:master into master
Former-commit-id: c6ea68e62c9850d50985fff5c388125a61f29c46
This commit is contained in:
commit
764ce65e8d
|
@ -33,8 +33,6 @@ func (l *StartDeployInstanceListLogic) StartDeployInstanceList(req *types.StartD
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins)
|
|
||||||
|
|
||||||
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StartInferDeployInstance(l.ctx, req.InstanceId)
|
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StartInferDeployInstance(l.ctx, req.InstanceId)
|
||||||
if !success {
|
if !success {
|
||||||
return nil, errors.New("start instance failed")
|
return nil, errors.New("start instance failed")
|
||||||
|
|
|
@ -33,8 +33,6 @@ func (l *StopDeployInstanceLogic) StopDeployInstance(req *types.StopDeployInstan
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins)
|
|
||||||
|
|
||||||
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StopInferDeployInstance(l.ctx, req.InstanceId)
|
success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StopInferDeployInstance(l.ctx, req.InstanceId)
|
||||||
if !success {
|
if !success {
|
||||||
return nil, errors.New("stop instance failed")
|
return nil, errors.New("stop instance failed")
|
||||||
|
|
|
@ -399,8 +399,10 @@ func (s *AiStorage) SaveInferDeployInstance(instanceId string, instanceName stri
|
||||||
return insModel.Id, nil
|
return insModel.Id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AiStorage) UpdateInferDeployInstance(instance *models.AiInferDeployInstance) error {
|
func (s *AiStorage) UpdateInferDeployInstance(instance *models.AiInferDeployInstance, needUpdateTime bool) error {
|
||||||
instance.UpdateTime = time.Now().Format(time.RFC3339)
|
if needUpdateTime {
|
||||||
|
instance.UpdateTime = time.Now().Format(time.RFC3339)
|
||||||
|
}
|
||||||
tx := s.DbEngin.Table("ai_infer_deploy_instance").Updates(instance)
|
tx := s.DbEngin.Table("ai_infer_deploy_instance").Updates(instance)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
logx.Errorf(tx.Error.Error())
|
logx.Errorf(tx.Error.Error())
|
||||||
|
|
|
@ -71,10 +71,8 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if updatetime {
|
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance, updatetime)
|
||||||
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance)
|
if err != nil {
|
||||||
if err != nil {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue