From a6db1a129eed17bded4c41a87833420b5c40ddec Mon Sep 17 00:00:00 2001 From: lowang-bh Date: Tue, 2 Jul 2024 15:02:03 +0800 Subject: [PATCH] support volcano v1.9.0 Signed-off-by: lowang-bh --- internal/rescheduling/reschedule_test.go | 4 ++-- plugin/node.go | 2 +- test/frame.go | 7 ++----- test/node.go | 2 +- test/reschedule.go | 5 +---- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/internal/rescheduling/reschedule_test.go b/internal/rescheduling/reschedule_test.go index aee34e81..62f7dc18 100644 --- a/internal/rescheduling/reschedule_test.go +++ b/internal/rescheduling/reschedule_test.go @@ -240,7 +240,7 @@ func fakeNPUNodeNilDeviceInfo(name string) *plugin.NPUNode { return &plugin.NPUNode{ CommonNode: plugin.CommonNode{ Name: name, - Capability: nodeInfo.Capability.ScalarResources, + Capability: nodeInfo.Capacity.ScalarResources, Allocate: nodeInfo.Allocatable.ScalarResources, Idle: nodeInfo.Idle.ScalarResources, Annotation: nodeInfo.Node.Annotations, @@ -261,7 +261,7 @@ func fakeNPUNodeWithDeviceInfo(name string) *plugin.NPUNode { npuNode := &plugin.NPUNode{ CommonNode: plugin.CommonNode{ Name: name, - Capability: nodeInfo.Capability.ScalarResources, + Capability: nodeInfo.Capacity.ScalarResources, Allocate: nodeInfo.Allocatable.ScalarResources, Idle: nodeInfo.Idle.ScalarResources, Annotation: anno, diff --git a/plugin/node.go b/plugin/node.go index 4187a5f4..2cd7ab3a 100644 --- a/plugin/node.go +++ b/plugin/node.go @@ -235,7 +235,7 @@ func (n *NPUNode) initNPUNodeByNodeInf(npuNode *api.NodeInfo, deviceInfos map[st return fmt.Errorf("getNodeDeviceInfoFromCM %s failed", npuNode.Name) } - capability := npuNode.Capability.ScalarResources + capability := npuNode.Capacity.ScalarResources if !util.IsMapHasNPUResource(capability, util.HwPreName) { return fmt.Errorf("%s not NPU node", npuNode.Name) } diff --git a/test/frame.go b/test/frame.go index a9f00c7f..05143b07 100644 --- a/test/frame.go +++ b/test/frame.go @@ -21,7 +21,7 @@ package test import ( "github.com/agiledragon/gomonkey/v2" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/client-go/tools/record" @@ -51,10 +51,7 @@ func AddConfigIntoFakeSSN(ssn *framework.Session, configs []conf.Configuration) // FakeNormalSSN fake normal test ssn. func FakeNormalSSN() *framework.Session { - binder := &util.FakeBinder{ - Binds: map[string]string{}, - Channel: make(chan string), - } + binder := util.NewFakeBinder(0) schedulerCache := &cache.SchedulerCache{ Nodes: make(map[string]*api.NodeInfo), Jobs: make(map[api.JobID]*api.JobInfo), diff --git a/test/node.go b/test/node.go index 809bf9ba..0dc4264c 100644 --- a/test/node.go +++ b/test/node.go @@ -77,6 +77,6 @@ func SetFakeNodeSource(nodeInf *api.NodeInfo, name string, value int) { nodeInf.Idle = &idle Capability := api.Resource{ScalarResources: map[v1.ResourceName]float64{ v1.ResourceName(name): float64(value) * NPUHexKilo}} - nodeInf.Capability = &Capability + nodeInf.Capacity = &Capability nodeInf.Allocatable = &Capability } diff --git a/test/reschedule.go b/test/reschedule.go index 8b5ec0df..b060afe6 100644 --- a/test/reschedule.go +++ b/test/reschedule.go @@ -30,10 +30,7 @@ import ( // FakeSSNReSchedule fake normal test ssn 2jobs. func FakeSSNReSchedule() *framework.Session { - binder := &util.FakeBinder{ - Binds: map[string]string{}, - Channel: make(chan string), - } + binder := util.NewFakeBinder(0) schedulerCache := &cache.SchedulerCache{ Nodes: make(map[string]*api.NodeInfo), Jobs: make(map[api.JobID]*api.JobInfo), -- Gitee