added shuguangai cluster resources function
Former-commit-id: 3f03d5c3a29e5e12f399e3da7087ab92e5f802e5
This commit is contained in:
parent
b04a3f1255
commit
3cc16100fa
|
@ -19,7 +19,7 @@ var (
|
|||
"Hanwuji": OCTOPUS,
|
||||
"Suiyan": OCTOPUS,
|
||||
"Sailingsi": OCTOPUS,
|
||||
"modelarts-CloudBrain2": MODELARTS,
|
||||
"Modelarts-CloudBrain2": MODELARTS,
|
||||
"ShuguangAi": SHUGUANGAI,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@ func TestReplication(t *testing.T) {
|
|||
{Name: "test2", Participant_id: 2},
|
||||
{Name: "test3", Participant_id: 3},
|
||||
}
|
||||
res := []*collector.ResourceSpecs{
|
||||
rsc := []*collector.ResourceSpecs{
|
||||
{
|
||||
ParticipantId: 1,
|
||||
Name: "test1",
|
||||
|
@ -47,7 +47,7 @@ func TestReplication(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
params := ¶m.Params{Resources: res}
|
||||
params := ¶m.Params{Resources: rsc}
|
||||
repl := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: tt.replica})
|
||||
schedule, err := repl.Schedule()
|
||||
if err != nil {
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/scheduler/service/collector"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -173,6 +174,28 @@ func (o *ShuguangAi) QuerySpecs() (interface{}, error) {
|
|||
}
|
||||
|
||||
func (o *ShuguangAi) GetResourceSpecs() (*collector.ResourceSpecs, error) {
|
||||
userReq := &hpcAC.GetUserInfoReq{}
|
||||
userinfo, err := o.svcCtx.ACRpc.GetUserInfo(o.ctx, userReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
limitReq := &hpcAC.QueueReq{}
|
||||
_, err = o.svcCtx.ACRpc.QueryUserQuotasLimit(o.ctx, limitReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
diskReq := &hpcAC.ParaStorQuotaReq{}
|
||||
_, err = o.svcCtx.ACRpc.ParaStorQuota(o.ctx, diskReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
balance, _ := strconv.ParseFloat(userinfo.Data.AccountBalance, 64)
|
||||
_ = &collector.ResourceSpecs{
|
||||
ParticipantId: o.participantId,
|
||||
Name: o.platform,
|
||||
Balance: balance,
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue