|
|
|
@@ -9,7 +9,25 @@ import ( |
|
|
|
"strconv" |
|
|
|
) |
|
|
|
|
|
|
|
func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInferDeployInstance) { |
|
|
|
func UpdateDeployInstanceStatusBatch(svc *svc.ServiceContext, insList []*models.AiInferDeployInstance) { |
|
|
|
list := make([]*models.AiInferDeployInstance, len(insList)) |
|
|
|
copy(list, insList) |
|
|
|
for i := len(list) - 1; i >= 0; i-- { |
|
|
|
if list[i].Status == constants.Running || list[i].Status == constants.Stopped { |
|
|
|
list = append(list[:i], list[i+1:]...) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if len(list) == 0 { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for _, instance := range list { |
|
|
|
go UpdateDeployInstanceStatus(svc, instance, false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInferDeployInstance, updatetime bool) { |
|
|
|
amap, found := svc.Scheduler.AiService.InferenceAdapterMap[strconv.FormatInt(instance.AdapterId, 10)] |
|
|
|
if !found { |
|
|
|
return |
|
|
|
@@ -44,8 +62,11 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe |
|
|
|
instance.Status = ins.Status |
|
|
|
} |
|
|
|
} |
|
|
|
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
|
|
|
|
if updatetime { |
|
|
|
err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |