Browse Source

update octopusHttp service

pull/508/head
tzwang 5 months ago
parent
commit
828a69eed7
3 changed files with 37 additions and 9 deletions
  1. +1
    -1
      go.mod
  2. +2
    -2
      go.sum
  3. +34
    -6
      internal/storeLink/octopusHttp/octopusHttp.go

+ 1
- 1
go.mod View File

@@ -24,7 +24,7 @@ require (
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20250107025835-8fc888b1d170
gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250313064001-91fb558cfdb6
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250618090521-cb5d253198dd
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250619094959-66dc370c4b6e
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5


+ 2
- 2
go.sum View File

@@ -539,8 +539,8 @@ gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4 h1:WIs/189l
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-20250313064001-91fb558cfdb6 h1:9o0ONbSiQHTzODptzgtVZjRYFBLncZ6dpHp9YF+v73I=
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20250313064001-91fb558cfdb6/go.mod h1:MxtnJJcU8S4zfGKZVcg2MOXGtwucKy7MMDwA0IemBd0=
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250618090521-cb5d253198dd h1:eyroYJi7pQO5OewN9C45u7xUEjegH7qclxIS0dLOfYY=
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250618090521-cb5d253198dd/go.mod h1:iQtyaoeMP4mNY0xutDBDD/305QwnPjj0zNtiQjXix50=
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250619094959-66dc370c4b6e h1:KbgH65QhfOYIrkRz1eUmCa9nJZsmEMnu6Fk84nGoyYA=
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20250619094959-66dc370c4b6e/go.mod h1:iQtyaoeMP4mNY0xutDBDD/305QwnPjj0zNtiQjXix50=
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee h1:+YYzcWPX0Up98nOb5ngkCaqiWHpSH7XJQRTUSvYclWU=
gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20250320103718-7bd6650118ee/go.mod h1:0VMTWXsRx7Z5z+kxBid2zf7kq5YtFlxubXEwPHiicyM=
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6PsZ1+bev294IWdZRlV7mnOwI1+UzFcldVW/BqhQzI=


+ 34
- 6
internal/storeLink/octopusHttp/octopusHttp.go View File

@@ -614,6 +614,26 @@ func chooseResourceType(spec *omodel.Spec) (*collector.ClusterResource, error) {
return nil, err
}
return cres, nil
} else if spec.ResourceQuantity.NvidiaV100 != "" {
tag, err := common2.GetJSONTag(spec.ResourceQuantity, "NvidiaV100")
if err != nil {
return nil, err
}
cres, err := genClusterResources(tag, spec.ResourceQuantity.NvidiaV100, spec)
if err != nil {
return nil, err
}
return cres, nil
} else if spec.ResourceQuantity.MetaxTechComGpu != "" {
tag, err := common2.GetJSONTag(spec.ResourceQuantity, "MetaxTechComGpu")
if err != nil {
return nil, err
}
cres, err := genClusterResources(tag, spec.ResourceQuantity.MetaxTechComGpu, spec)
if err != nil {
return nil, err
}
return cres, nil
}

return nil, nil
@@ -625,6 +645,7 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector.

var cardNum int64
var cpuCore int64
var memGi int64

cardNum, err := strconv.ParseInt(cNum, 10, 64)
if err != nil {
@@ -634,13 +655,20 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector.
if err != nil {
cpuCore = 0
}
gi := strings.Split(s.ResourceQuantity.Memory, Gi)
if len(gi) != 2 {
return nil, fmt.Errorf("s.ResourceQuantity.Memory convert error: %s", s.ResourceQuantity.Memory)
}

memGi, err := strconv.ParseInt(gi[0], 10, 64)
if err != nil {
if s.ResourceQuantity.Memory != "" {
gi := strings.Split(s.ResourceQuantity.Memory, Gi)
if len(gi) != 2 {
return nil, fmt.Errorf("s.ResourceQuantity.Memory convert error: %s", s.ResourceQuantity.Memory)
}

mGi, err := strconv.ParseInt(gi[0], 10, 64)
if err != nil {
memGi = 0
} else {
memGi = mGi
}
} else {
memGi = 0
}



Loading…
Cancel
Save