This is an automated email from the ASF dual-hosted git repository.
wilfreds pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new 4816aa25 [YUNIKORN-2246] remove deprecated FitIn function (#751)
4816aa25 is described below
commit 4816aa2511e9ebd0a685e8a1c3912e4cbd2e9b46
Author: Kuan-Po Tseng <[email protected]>
AuthorDate: Tue Dec 12 11:42:21 2023 +1100
[YUNIKORN-2246] remove deprecated FitIn function (#751)
Closes: #751
Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
pkg/common/resources/resources.go | 8 --------
pkg/common/resources/resources_test.go | 2 +-
pkg/scheduler/objects/preemption.go | 6 +++---
pkg/scheduler/objects/queue.go | 2 +-
4 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/pkg/common/resources/resources.go
b/pkg/common/resources/resources.go
index 7b64fe1a..26156100 100644
--- a/pkg/common/resources/resources.go
+++ b/pkg/common/resources/resources.go
@@ -417,14 +417,6 @@ func subNonNegative(left, right *Resource) (*Resource,
string) {
return out, message
}
-// FitIn Checks if smaller fits in larger
-// Types not defined in the larger resource are considered 0 values for
Quantity
-// A nil resource is treated as an empty resource (all types are 0)
-// Deprecated: use receiver version Resource.FitIn
-func FitIn(larger, smaller *Resource) bool {
- return larger.fitIn(smaller, false)
-}
-
// FitIn checks if smaller fits in the defined resource
// Types not defined in resource this is called against are considered 0 for
Quantity
// A nil resource is treated as an empty resource (no types defined)
diff --git a/pkg/common/resources/resources_test.go
b/pkg/common/resources/resources_test.go
index 9be92d79..3917dd6f 100644
--- a/pkg/common/resources/resources_test.go
+++ b/pkg/common/resources/resources_test.go
@@ -1051,7 +1051,7 @@ func TestFitIn(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- assert.Equal(t, FitIn(tt.larger, tt.smaller), tt.want,
"unexpected FitIn result (parameter method)")
+ assert.Equal(t, tt.larger.FitIn(tt.smaller), tt.want,
"unexpected FitIn result (parameter method)")
assert.Equal(t, tt.larger.FitIn(tt.smaller), tt.want,
"unexpected FitIn result (receiver method)")
})
}
diff --git a/pkg/scheduler/objects/preemption.go
b/pkg/scheduler/objects/preemption.go
index 1dc43d89..ebf82da8 100644
--- a/pkg/scheduler/objects/preemption.go
+++ b/pkg/scheduler/objects/preemption.go
@@ -213,7 +213,7 @@ func (p *Preemptor) calculateVictimsByNode(nodeAvailable
*resources.Resource, po
// Initial check: Will allocation fit on node without preemption? This
is possible if preemption was triggered due
// to queue limits and not node resource limits.
- if resources.FitIn(nodeCurrentAvailable, p.ask.GetAllocatedResource()) {
+ if nodeCurrentAvailable.FitIn(p.ask.GetAllocatedResource()) {
// return empty list so this node is considered for preemption
return -1, make([]*Allocation, 0)
}
@@ -713,7 +713,7 @@ func (qps *QueuePreemptionSnapshot)
IsAtOrAboveGuaranteedResource() bool {
used := resources.Sub(qps.AllocatedResource, qps.PreemptingResource)
// if we don't fit, we're clearly above
- if !resources.FitIn(absGuaranteed, used) {
+ if !absGuaranteed.FitIn(used) {
return true
}
@@ -739,7 +739,7 @@ func (qps *QueuePreemptionSnapshot)
IsWithinGuaranteedResource() bool {
max := qps.GetMaxResource()
absGuaranteed := resources.ComponentWiseMinPermissive(guaranteed, max)
used := resources.Sub(qps.AllocatedResource, qps.PreemptingResource)
- return resources.FitIn(absGuaranteed, used)
+ return absGuaranteed.FitIn(used)
}
func (qps *QueuePreemptionSnapshot) GetRemainingGuaranteed()
*resources.Resource {
diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index de02b35f..9ae27f9d 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -1059,7 +1059,7 @@ func (sq *Queue) DecAllocatedResource(alloc
*resources.Resource) error {
defer sq.Unlock()
// check this queue: failure stops checks
- if alloc != nil && !resources.FitIn(sq.allocatedResource, alloc) {
+ if alloc != nil && !sq.allocatedResource.FitIn(alloc) {
return fmt.Errorf("released allocation (%v) is larger than '%s'
queue allocation (%v)",
alloc, sq.QueuePath, sq.allocatedResource)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]