forked from JointCloud/pcm-coordinator
updated queryResources
This commit is contained in:
parent
9d004a2430
commit
db654de359
6
go.sum
6
go.sum
|
@ -528,12 +528,6 @@ gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170 h1:/n3pl6WuH
|
|||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4 h1:WIs/189lRLNMXF2ui/Wm1+Y55eJ53BVGx+4+gdn9cls=
|
||||
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4/go.mod h1:YbuoRgF9sEVvNJPQtGRjdocX7Du6NBOTLn+GVwqRVjo=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20241211021152-9771ba5670b7 h1:sPyw2qIID5vY/eJBY9UiHBzIF/gk0GUhei9sRIADrE4=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20241211021152-9771ba5670b7/go.mod h1:V19vFg8dWRAbaskASoSj70dgpacswOqZu/SaI02dxac=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250107100442-f1114f7b6231 h1:Svk5SjRiPInj6c8fn/SM/nXuGQ5wzKC1mLgE5jet0H8=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250107100442-f1114f7b6231/go.mod h1:V19vFg8dWRAbaskASoSj70dgpacswOqZu/SaI02dxac=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250108025929-5fb49198c385 h1:RxOh79LrAHSEFyexWVa5YG3NsNJaMwj/hnzK3Oio51M=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250108025929-5fb49198c385/go.mod h1:V19vFg8dWRAbaskASoSj70dgpacswOqZu/SaI02dxac=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250108072048-9adf0597b07c h1:9LphS29VNfoWT73eqhgwKV1nG8PcoDUNu7dRev845wA=
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250108072048-9adf0597b07c/go.mod h1:V19vFg8dWRAbaskASoSj70dgpacswOqZu/SaI02dxac=
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 h1:GaXwr5sgDh0raHjUf9IewTvnRvajYea7zbLsaerYyXo=
|
||||
|
|
|
@ -563,23 +563,6 @@ func (o OpenI) GetResourceSpecs(ctx context.Context) (*collector.ResourceSpec, e
|
|||
}
|
||||
|
||||
ch <- &collector.ClusterResource{Resource: rate}
|
||||
|
||||
//storage
|
||||
var s float64
|
||||
s = 1024
|
||||
storage := &collector.Usage{}
|
||||
storage.Type = STORAGE
|
||||
storage.Name = DISK
|
||||
storage.Total = &collector.UnitValue{
|
||||
Unit: GIGABYTE,
|
||||
Value: s,
|
||||
}
|
||||
storage.Available = &collector.UnitValue{
|
||||
Unit: GIGABYTE,
|
||||
Value: s,
|
||||
}
|
||||
|
||||
ch <- &collector.ClusterResource{Resource: storage}
|
||||
}
|
||||
once.Do(balanceCheck)
|
||||
|
||||
|
@ -636,6 +619,23 @@ func (o OpenI) GetResourceSpecs(ctx context.Context) (*collector.ResourceSpec, e
|
|||
Total: &collector.UnitValue{Unit: GIGABYTE, Value: v.GpuMemGiB},
|
||||
Available: &collector.UnitValue{Unit: GIGABYTE, Value: v.GpuMemGiB},
|
||||
}
|
||||
|
||||
//storage
|
||||
var s float64
|
||||
s = 1024
|
||||
storage := &collector.Usage{}
|
||||
storage.Type = STORAGE
|
||||
storage.Name = DISK
|
||||
storage.Total = &collector.UnitValue{
|
||||
Unit: GIGABYTE,
|
||||
Value: s,
|
||||
}
|
||||
storage.Available = &collector.UnitValue{
|
||||
Unit: GIGABYTE,
|
||||
Value: s,
|
||||
}
|
||||
|
||||
bres = append(bres, storage)
|
||||
bres = append(bres, cpu)
|
||||
bres = append(bres, mem)
|
||||
bres = append(bres, vmem)
|
||||
|
|
|
@ -1082,10 +1082,11 @@ func (s *ShuguangAi) CheckModelExistence(ctx context.Context, name string, mtype
|
|||
func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceSpec, error) {
|
||||
var wg sync.WaitGroup
|
||||
var uwg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
uwg.Add(4)
|
||||
wg.Add(3)
|
||||
uwg.Add(3)
|
||||
var ch = make(chan *collector.Usage, 2)
|
||||
var qCh = make(chan *collector.Usage, 2)
|
||||
var sch = make(chan *collector.Usage, 1)
|
||||
var cresCh = make(chan *collector.ClusterResource)
|
||||
|
||||
resUsage := &collector.ResourceSpec{
|
||||
|
@ -1246,7 +1247,8 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS
|
|||
|
||||
// 查询用户共享存储配额及使用量
|
||||
go func() {
|
||||
defer uwg.Done()
|
||||
defer wg.Done()
|
||||
defer close(sch)
|
||||
diskReq := &hpcAC.ParaStorQuotaReq{}
|
||||
diskResp, err := s.aCRpc.ParaStorQuota(ctx, diskReq)
|
||||
if err != nil {
|
||||
|
@ -1268,8 +1270,7 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS
|
|||
Value: availStorage,
|
||||
}
|
||||
|
||||
cresCh <- &collector.ClusterResource{Resource: storage}
|
||||
|
||||
sch <- storage
|
||||
}()
|
||||
|
||||
// 查询用户信息
|
||||
|
@ -1327,6 +1328,10 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS
|
|||
}
|
||||
}
|
||||
|
||||
for v := range sch {
|
||||
bres = append(bres, v)
|
||||
}
|
||||
|
||||
cres.BaseResources = bres
|
||||
resources = append(resources, cres)
|
||||
resUsage.Resources = resources
|
||||
|
|
Loading…
Reference in New Issue