From b13d28550441cb5f73ee6ea6945b6d6b33c65223 Mon Sep 17 00:00:00 2001 From: tzwang Date: Wed, 18 Sep 2024 17:36:44 +0800 Subject: [PATCH] updated cron func --- go.mod | 2 +- go.sum | 4 ++-- internal/cron/cron.go | 2 +- .../inference/imageInference/imageInference.go | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 99eda2130..4d92673b9 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/prometheus/common v0.59.1 github.com/robfig/cron/v3 v3.0.1 github.com/zeromicro/go-zero v1.7.2 - gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1 + gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240918015229-59c579d1a437 gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240909072501-939c3144cd9e gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 diff --git a/go.sum b/go.sum index 4b6cd18b2..f5302a5e6 100644 --- a/go.sum +++ b/go.sum @@ -466,8 +466,8 @@ github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= github.com/zeromicro/go-zero v1.7.2 h1:a8lyVOG3KXG4LrAy6ZmtJTJtisX4Ostc4Pst4fE704I= github.com/zeromicro/go-zero v1.7.2/go.mod h1:WFXfF92Exw0O7WECifS6r99JSzv4KEN49x9RhAfgkMc= -gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1 h1:DicBXoQiC6mumMBeyqSPNrsjtqJIgk5Pv2hscu2xryw= -gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY= +gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240918015229-59c579d1a437 h1:ta6h9+FU7AQ2fNyQiXrZnMdlNBjOKdyBx4e3RF7BE84= +gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240918015229-59c579d1a437/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY= gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240909072501-939c3144cd9e h1:6LYJggBoeAQxy/otzWjt40Pa7gnVvUR4c5YMi6A/NdU= gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240909072501-939c3144cd9e/go.mod h1:/eOmBFZKWGoabG3sRVkVvIbLwsd2631k4jkUBR6x1AA= gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 h1:GaXwr5sgDh0raHjUf9IewTvnRvajYea7zbLsaerYyXo= diff --git a/internal/cron/cron.go b/internal/cron/cron.go index 78712a9c4..bd8624c1c 100644 --- a/internal/cron/cron.go +++ b/internal/cron/cron.go @@ -37,7 +37,7 @@ func AddCronGroup(svc *svc.ServiceContext) { UpdateAiAdapterMaps(svc) }) - svc.Cron.AddFunc("*/59 * * * * ?", func() { + svc.Cron.AddFunc("30 * * * * ?", func() { adapterList, err := svc.Scheduler.AiStorages.GetAdaptersByType("1") if err != nil { logx.Errorf(err.Error()) diff --git a/internal/scheduler/service/inference/imageInference/imageInference.go b/internal/scheduler/service/inference/imageInference/imageInference.go index c2961812e..ba524db6f 100644 --- a/internal/scheduler/service/inference/imageInference/imageInference.go +++ b/internal/scheduler/service/inference/imageInference/imageInference.go @@ -290,22 +290,22 @@ func (i *ImageInference) updateStatus(aiTaskList []*models.TaskAi, cs []*Filtere //change cluster status if len(i.clusters) != len(cs) { - var acs []*strategy.AssignedCluster - var rcs []*strategy.AssignedCluster + var failedclusters []*strategy.AssignedCluster + var runningclusters []*strategy.AssignedCluster for _, cluster := range i.clusters { if contains(cs, cluster.ClusterId) { var ac *strategy.AssignedCluster ac = cluster - rcs = append(rcs, ac) + runningclusters = append(runningclusters, ac) } else { var ac *strategy.AssignedCluster ac = cluster - acs = append(acs, ac) + failedclusters = append(failedclusters, ac) } } // update failed cluster status - for _, ac := range acs { + for _, ac := range failedclusters { for _, t := range aiTaskList { if ac.ClusterId == strconv.Itoa(int(t.ClusterId)) { t.Status = constants.Failed @@ -322,7 +322,7 @@ func (i *ImageInference) updateStatus(aiTaskList []*models.TaskAi, cs []*Filtere } // update running cluster status - for _, ac := range rcs { + for _, ac := range runningclusters { for _, t := range aiTaskList { if ac.ClusterId == strconv.Itoa(int(t.ClusterId)) { t.Status = constants.Running