You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by pb...@apache.org on 2023/08/08 14:55:31 UTC
[yunikorn-core] branch master updated: [YUNIKORN-1906] remove unused queueName parameter (#614)
This is an automated email from the ASF dual-hosted git repository.
pbacsko 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 7ac5ae38 [YUNIKORN-1906] remove unused queueName parameter (#614)
7ac5ae38 is described below
commit 7ac5ae38672c009ed072df0a7780e273280ad9fb
Author: Frank Yang <ya...@gmail.com>
AuthorDate: Tue Aug 8 16:55:20 2023 +0200
[YUNIKORN-1906] remove unused queueName parameter (#614)
Signed-off-by: Frank Yang <ya...@gmail.com>
Closes: #614
Signed-off-by: Peter Bacsko <pb...@cloudera.com>
---
pkg/scheduler/objects/application_test.go | 68 +++++++++++++--------------
pkg/scheduler/objects/node_collection_test.go | 8 ++--
pkg/scheduler/objects/node_test.go | 22 ++++-----
pkg/scheduler/objects/nodesorting_test.go | 6 +--
pkg/scheduler/objects/queue_test.go | 4 +-
pkg/scheduler/objects/utilities_test.go | 4 +-
6 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/pkg/scheduler/objects/application_test.go b/pkg/scheduler/objects/application_test.go
index c234b589..cc12b5ad 100644
--- a/pkg/scheduler/objects/application_test.go
+++ b/pkg/scheduler/objects/application_test.go
@@ -839,7 +839,7 @@ func TestAllocations(t *testing.T) {
resMap := map[string]string{"memory": "100", "vcores": "10"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
app.AddAllocation(alloc)
if !resources.Equals(app.allocatedResource, res) {
t.Errorf("allocated resources is not updated correctly: %v", app.allocatedResource)
@@ -850,10 +850,10 @@ func TestAllocations(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 1))
// add more allocations to test the removals
- alloc = newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-2", nodeID1, res)
app.AddAllocation(alloc)
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
- alloc = newAllocation(appID1, "uuid-3", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-3", nodeID1, res)
app.AddAllocation(alloc)
allocs = app.GetAllAllocations()
assert.Equal(t, len(allocs), 3)
@@ -896,7 +896,7 @@ func TestGangAllocChange(t *testing.T) {
var res *resources.Resource
res, err = resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
alloc.placeholder = true
app.AddAllocation(alloc)
assert.Assert(t, resources.Equals(app.allocatedPlaceholder, res), "allocated placeholders resources is not updated correctly: %s", app.allocatedPlaceholder.String())
@@ -905,7 +905,7 @@ func TestGangAllocChange(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), res)
// add second placeholder this should trigger state update
- alloc = newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-2", nodeID1, res)
alloc.placeholder = true
app.AddAllocation(alloc)
assert.Assert(t, resources.Equals(app.allocatedPlaceholder, totalPH), "allocated placeholders resources is not updated correctly: %s", app.allocatedPlaceholder.String())
@@ -914,7 +914,7 @@ func TestGangAllocChange(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
// add a real alloc this should NOT trigger state update
- alloc = newAllocation(appID1, "uuid-3", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-3", nodeID1, res)
alloc.SetResult(Replaced)
app.AddAllocation(alloc)
assert.Equal(t, len(app.GetAllAllocations()), 3)
@@ -922,7 +922,7 @@ func TestGangAllocChange(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 3))
// add a second real alloc this should trigger state update
- alloc = newAllocation(appID1, "uuid-4", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-4", nodeID1, res)
alloc.SetResult(Replaced)
app.AddAllocation(alloc)
assert.Equal(t, len(app.GetAllAllocations()), 4)
@@ -943,7 +943,7 @@ func TestAllocChange(t *testing.T) {
resMap := map[string]string{"first": "2"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
// adding a normal allocation should change the state
app.AddAllocation(alloc)
assert.Assert(t, resources.Equals(app.allocatedResource, res), "allocated resources is not updated correctly: %s", app.allocatedResource.String())
@@ -952,7 +952,7 @@ func TestAllocChange(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), res)
// add a second real alloc this should trigger state update
- alloc = newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-2", nodeID1, res)
app.AddAllocation(alloc)
assert.Equal(t, len(app.GetAllAllocations()), 2)
assert.Assert(t, app.IsRunning(), "app should have changed to running` state")
@@ -1080,7 +1080,7 @@ func TestResourceUsageAggregation(t *testing.T) {
resMap := map[string]string{"memory": "100", "vcores": "10"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
app.AddAllocation(alloc)
if !resources.Equals(app.allocatedResource, res) {
t.Errorf("allocated resources is not updated correctly: %v", app.allocatedResource)
@@ -1100,7 +1100,7 @@ func TestResourceUsageAggregation(t *testing.T) {
assertResourceUsage(t, appSummary, 0, 0)
// add more allocations to test the removals
- alloc = newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-2", nodeID1, res)
app.AddAllocation(alloc)
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
@@ -1116,7 +1116,7 @@ func TestResourceUsageAggregation(t *testing.T) {
appSummary.DoLogging()
assertResourceUsage(t, appSummary, 300, 30)
- alloc = newAllocation(appID1, "uuid-3", nodeID1, "root.a", res)
+ alloc = newAllocation(appID1, "uuid-3", nodeID1, res)
app.AddAllocation(alloc)
allocs = app.GetAllAllocations()
assert.Equal(t, len(allocs), 2)
@@ -1227,7 +1227,7 @@ func TestReplaceAllocation(t *testing.T) {
resMap := map[string]string{"memory": "100", "vcores": "10"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- ph := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, "root.a", res)
+ ph := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, res)
// add the placeholder to the app
app.AddAllocation(ph)
// add PlaceholderData
@@ -1257,7 +1257,7 @@ func TestReplaceAllocation(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), res)
// set the real one to replace the placeholder
- realAlloc := newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ realAlloc := newAllocation(appID1, "uuid-2", nodeID1, res)
realAlloc.SetResult(Replaced)
ph.AddRelease(realAlloc)
alloc = app.ReplaceAllocation("uuid-1")
@@ -1279,10 +1279,10 @@ func TestReplaceAllocation(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
// set multiple real allocations to replace the placeholder
- realAlloc = newAllocation(appID1, "uuid-3", nodeID1, "root.a", res)
+ realAlloc = newAllocation(appID1, "uuid-3", nodeID1, res)
realAlloc.SetResult(Replaced)
ph.AddRelease(realAlloc)
- realAllocNoAdd := newAllocation(appID1, "not-added", nodeID1, "root.a", res)
+ realAllocNoAdd := newAllocation(appID1, "not-added", nodeID1, res)
realAllocNoAdd.SetResult(Replaced)
ph.AddRelease(realAlloc)
alloc = app.ReplaceAllocation("uuid-1")
@@ -1309,9 +1309,9 @@ func TestReplaceAllocationTracking(t *testing.T) {
resMap := map[string]string{"memory": "100", "vcores": "10"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- ph1 := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, "root.a", res)
- ph2 := newPlaceholderAlloc(appID1, "uuid-2", nodeID1, "root.a", res)
- ph3 := newPlaceholderAlloc(appID1, "uuid-3", nodeID1, "root.a", res)
+ ph1 := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, res)
+ ph2 := newPlaceholderAlloc(appID1, "uuid-2", nodeID1, res)
+ ph3 := newPlaceholderAlloc(appID1, "uuid-3", nodeID1, res)
app.AddAllocation(ph1)
assert.NilError(t, err, "could not add ask")
app.addPlaceholderDataWithLocking(ph1.GetAsk())
@@ -1324,21 +1324,21 @@ func TestReplaceAllocationTracking(t *testing.T) {
app.addPlaceholderDataWithLocking(ph3.GetAsk())
// replace placeholders
- realAlloc1 := newAllocation(appID1, "uuid-100", nodeID1, "root.a", res)
+ realAlloc1 := newAllocation(appID1, "uuid-100", nodeID1, res)
realAlloc1.SetResult(Replaced)
ph1.AddRelease(realAlloc1)
alloc := app.ReplaceAllocation("uuid-1")
app.RemoveAllocation("uuid-1", si.TerminationType_PLACEHOLDER_REPLACED)
assert.Equal(t, "uuid-1", alloc.uuid)
assert.Equal(t, true, app.HasPlaceholderAllocation())
- realAlloc2 := newAllocation(appID1, "uuid-200", nodeID1, "root.a", res)
+ realAlloc2 := newAllocation(appID1, "uuid-200", nodeID1, res)
realAlloc2.SetResult(Replaced)
ph2.AddRelease(realAlloc2)
alloc = app.ReplaceAllocation("uuid-2")
app.RemoveAllocation("uuid-2", si.TerminationType_PLACEHOLDER_REPLACED)
assert.Equal(t, "uuid-2", alloc.uuid)
assert.Equal(t, true, app.HasPlaceholderAllocation())
- realAlloc3 := newAllocation(appID1, "uuid-300", nodeID1, "root.a", res)
+ realAlloc3 := newAllocation(appID1, "uuid-300", nodeID1, res)
realAlloc3.SetResult(Replaced)
ph3.AddRelease(realAlloc3)
alloc = app.ReplaceAllocation("uuid-3")
@@ -1390,12 +1390,12 @@ func runTimeoutPlaceholderTest(t *testing.T, expectedState string, gangSchedulin
assert.DeepEqual(t, app.placeholderData[tg1].MinResource, res)
// add the placeholder to the app
- ph := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, "root.a", res)
+ ph := newPlaceholderAlloc(appID1, "uuid-1", nodeID1, res)
app.AddAllocation(ph)
assertUserGroupResource(t, getTestUserGroup(), res)
assert.Assert(t, app.getPlaceholderTimer() != nil, "Placeholder timer should be initiated after the first placeholder allocation")
// add a second one to check the filter
- ph = newPlaceholderAlloc(appID1, "uuid-2", nodeID1, "root.a", res)
+ ph = newPlaceholderAlloc(appID1, "uuid-2", nodeID1, res)
app.AddAllocation(ph)
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
err = common.WaitFor(10*time.Millisecond, 1*time.Second, func() bool {
@@ -1452,7 +1452,7 @@ func TestTimeoutPlaceholderAllocReleased(t *testing.T) {
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "Unexpected error when creating resource from map")
// add the placeholders to the app: one released, one still available.
- ph := newPlaceholderAlloc(appID1, "released", nodeID1, "root.a", res)
+ ph := newPlaceholderAlloc(appID1, "released", nodeID1, res)
ph.SetReleased(true)
app.AddAllocation(ph)
// add PlaceholderData
@@ -1466,13 +1466,13 @@ func TestTimeoutPlaceholderAllocReleased(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 1))
assert.Assert(t, app.getPlaceholderTimer() != nil, "Placeholder timer should be initiated after the first placeholder allocation")
- ph = newPlaceholderAlloc(appID1, "waiting", nodeID1, "root.a", res)
+ ph = newPlaceholderAlloc(appID1, "waiting", nodeID1, res)
app.AddAllocation(ph)
app.addPlaceholderDataWithLocking(ph.GetAsk())
assert.Equal(t, app.placeholderData[""].Count, int64(2))
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
- alloc := newAllocation(appID1, "real", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "real", nodeID1, res)
app.AddAllocation(alloc)
assert.Assert(t, app.IsStarting(), "App should be in starting state after the first allocation")
err = common.WaitFor(10*time.Millisecond, 1*time.Second, func() bool {
@@ -1515,12 +1515,12 @@ func TestTimeoutPlaceholderCompleting(t *testing.T) {
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "Unexpected error when creating resource from map")
// add the placeholder to the app
- ph := newPlaceholderAlloc(appID1, "waiting", nodeID1, "root.a", res)
+ ph := newPlaceholderAlloc(appID1, "waiting", nodeID1, res)
app.AddAllocation(ph)
assert.Assert(t, app.getPlaceholderTimer() != nil, "Placeholder timer should be initiated after the first placeholder allocation")
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 1))
// add a real allocation as well
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
app.AddAllocation(alloc)
// move on to running
app.SetState(Running.String())
@@ -1562,12 +1562,12 @@ func TestAppTimersAfterAppRemoval(t *testing.T) {
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "Unexpected error when creating resource from map")
// add the placeholder to the app
- ph := newPlaceholderAlloc(appID1, "waiting", nodeID1, "root.a", res)
+ ph := newPlaceholderAlloc(appID1, "waiting", nodeID1, res)
app.AddAllocation(ph)
assert.Assert(t, app.getPlaceholderTimer() != nil, "Placeholder timer should be initiated after the first placeholder allocation")
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 1))
// add a real allocation as well
- alloc := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
+ alloc := newAllocation(appID1, "uuid-1", nodeID1, res)
app.AddAllocation(alloc)
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res, 2))
// move on to running
@@ -2072,8 +2072,8 @@ func TestAllocationEvents(t *testing.T) { //nolint:funlen
resMap := map[string]string{"memory": "100", "vcores": "10"}
res, err := resources.NewResourceFromConf(resMap)
assert.NilError(t, err, "failed to create resource with error")
- alloc1 := newAllocation(appID1, "uuid-1", nodeID1, "root.a", res)
- alloc2 := newAllocation(appID1, "uuid-2", nodeID1, "root.a", res)
+ alloc1 := newAllocation(appID1, "uuid-1", nodeID1, res)
+ alloc2 := newAllocation(appID1, "uuid-2", nodeID1, res)
// add + remove
app.AddAllocation(alloc1)
@@ -2188,7 +2188,7 @@ func TestPlaceholderLargerEvent(t *testing.T) {
assert.NilError(t, err, "queue create failed")
app.queue = queue
// smallerRes < res in the same task group, so delta will be -50 memory
- alloc1 := newAllocation(appID1, "uuid-1", nodeID1, "root.a", smallerRes)
+ alloc1 := newAllocation(appID1, "uuid-1", nodeID1, smallerRes)
alloc1.placeholder = true
alloc1.taskGroupName = "testGroup"
app.AddAllocation(alloc1)
diff --git a/pkg/scheduler/objects/node_collection_test.go b/pkg/scheduler/objects/node_collection_test.go
index b5626172..3755cc05 100644
--- a/pkg/scheduler/objects/node_collection_test.go
+++ b/pkg/scheduler/objects/node_collection_test.go
@@ -163,7 +163,7 @@ func TestSetNodeSortingPolicy(t *testing.T) {
for id := 0; id < len(nodesInfo); id++ {
node := newNode(nodesInfo[id].nodeID, map[string]resources.Quantity{"vcore": resources.Quantity(defaultCapicity[0]), "memory": resources.Quantity(defaultCapicity[1])})
res := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": resources.Quantity(nodesInfo[id].allocatedVcore), "memory": resources.Quantity(nodesInfo[id].allocatedMem)})
- alloc := newAllocation(fmt.Sprintf("test-app-%d", id+1), uuid.NewString(), fmt.Sprintf("test-%d", id+1), "root.default", res)
+ alloc := newAllocation(fmt.Sprintf("test-app-%d", id+1), uuid.NewString(), fmt.Sprintf("test-%d", id+1), res)
if ok := node.AddAllocation(alloc); !ok {
t.Error("Allocation error happen in node.")
}
@@ -229,7 +229,7 @@ func TestGetNodeSortingPolicy(t *testing.T) {
for id := 1; id < len(nodeNames)+1; id++ {
node := newNode(nodeNames[id-1], map[string]resources.Quantity{"vcore": resources.Quantity(6)})
res := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": resources.Quantity(id)})
- alloc := newAllocation(fmt.Sprintf("test-app-%d", id+1), uuid.NewString(), fmt.Sprintf("test-%d", id), "root.default", res)
+ alloc := newAllocation(fmt.Sprintf("test-app-%d", id+1), uuid.NewString(), fmt.Sprintf("test-%d", id), res)
node.AddAllocation(alloc)
if err := nc.AddNode(node); err != nil {
@@ -298,7 +298,7 @@ func TestGetFullNodeIterator(t *testing.T) {
}
} else {
res := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": resources.Quantity(i)})
- alloc := newAllocation(fmt.Sprintf("test-app-%d", i), uuid.NewString(), fmt.Sprintf("test-%d", i), "root.default", res)
+ alloc := newAllocation(fmt.Sprintf("test-app-%d", i), uuid.NewString(), fmt.Sprintf("test-%d", i), res)
if ok := node.AddAllocation(alloc); !ok {
t.Error("Allocation error in node.")
}
@@ -347,7 +347,7 @@ func TestGetNodeIterator(t *testing.T) {
}
} else {
res := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": resources.Quantity(i)})
- alloc := newAllocation(fmt.Sprintf("test-app-%d", i), uuid.NewString(), fmt.Sprintf("test-%d", i), "root.default", res)
+ alloc := newAllocation(fmt.Sprintf("test-app-%d", i), uuid.NewString(), fmt.Sprintf("test-%d", i), res)
if ok := node.AddAllocation(alloc); !ok {
t.Error("Allocation error happen in node.")
}
diff --git a/pkg/scheduler/objects/node_test.go b/pkg/scheduler/objects/node_test.go
index 31b02e9b..d37d696c 100644
--- a/pkg/scheduler/objects/node_test.go
+++ b/pkg/scheduler/objects/node_test.go
@@ -131,7 +131,7 @@ func TestPreAllocateCheck(t *testing.T) {
assert.Assert(t, !node.preAllocateCheck(resLarge, ""), "too large resource should not have fitted on node")
// set allocated resource
- node.AddAllocation(newAllocation(appID1, "UUID1", nodeID, "root.default", resSmall))
+ node.AddAllocation(newAllocation(appID1, "UUID1", nodeID, resSmall))
assert.Assert(t, node.preAllocateCheck(resSmall, ""), "small resource should have fitted in available allocation")
assert.Assert(t, !node.preAllocateCheck(resNode, ""), "node resource should not have fitted in available allocation")
@@ -370,7 +370,7 @@ func TestAddAllocation(t *testing.T) {
}
// allocate half of the resources available and check the calculation
half := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 50, "second": 100})
- node.AddAllocation(newAllocation(appID1, "1", nodeID1, "queue-1", half))
+ node.AddAllocation(newAllocation(appID1, "1", nodeID1, half))
if node.GetAllocation("1") == nil {
t.Fatal("failed to add allocations: allocation not returned")
}
@@ -386,7 +386,7 @@ func TestAddAllocation(t *testing.T) {
}
// second and check calculation
piece := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 25, "second": 50})
- node.AddAllocation(newAllocation(appID1, "2", nodeID1, "queue-1", piece))
+ node.AddAllocation(newAllocation(appID1, "2", nodeID1, piece))
if node.GetAllocation("2") == nil {
t.Fatal("failed to add allocations: allocation not returned")
}
@@ -412,7 +412,7 @@ func TestRemoveAllocation(t *testing.T) {
// allocate half of the resources available and check the calculation
half := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 50, "second": 100})
- node.AddAllocation(newAllocation(appID1, "1", nodeID1, "queue-1", half))
+ node.AddAllocation(newAllocation(appID1, "1", nodeID1, half))
if node.GetAllocation("1") == nil {
t.Fatal("failed to add allocations: allocation not returned")
}
@@ -429,7 +429,7 @@ func TestRemoveAllocation(t *testing.T) {
// add second alloc and remove first check calculation
piece := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 25, "second": 50})
- node.AddAllocation(newAllocation(appID1, "2", nodeID1, "queue-1", piece))
+ node.AddAllocation(newAllocation(appID1, "2", nodeID1, piece))
if node.GetAllocation("2") == nil {
t.Fatal("failed to add allocations: allocation not returned")
}
@@ -457,7 +457,7 @@ func TestNodeReplaceAllocation(t *testing.T) {
// allocate half of the resources available and check the calculation
phID := "ph-1"
half := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 50, "second": 100})
- ph := newPlaceholderAlloc(appID1, phID, nodeID1, "queue-1", half)
+ ph := newPlaceholderAlloc(appID1, phID, nodeID1, half)
node.AddAllocation(ph)
assert.Assert(t, node.GetAllocation(phID) != nil, "failed to add placeholder allocation")
assert.Assert(t, resources.Equals(node.GetAllocatedResource(), half), "allocated resource not set correctly %v got %v", half, node.GetAllocatedResource())
@@ -465,7 +465,7 @@ func TestNodeReplaceAllocation(t *testing.T) {
allocID := "real-1"
piece := resources.NewResourceFromMap(map[string]resources.Quantity{"first": 25, "second": 50})
- alloc := newAllocation(appID1, allocID, nodeID1, "queue-1", piece)
+ alloc := newAllocation(appID1, allocID, nodeID1, piece)
// calculate the delta: new allocation resource - placeholder (should be negative!)
delta := resources.Sub(piece, half)
assert.Assert(t, delta.HasNegativeValue(), "expected negative values in delta")
@@ -491,7 +491,7 @@ func TestGetAllocation(t *testing.T) {
if alloc != nil {
t.Fatalf("allocation should not have been found")
}
- node.AddAllocation(newAllocation(appID1, "1", nodeID1, "queue-1", nil))
+ node.AddAllocation(newAllocation(appID1, "1", nodeID1, nil))
alloc = node.GetAllocation("1")
if alloc == nil {
t.Fatalf("allocation should have been found")
@@ -516,11 +516,11 @@ func TestGetAllocations(t *testing.T) {
}
// allocate
- node.AddAllocation(newAllocation(appID1, "1", nodeID1, "queue-1", nil))
- node.AddAllocation(newAllocation(appID1, "2", nodeID1, "queue-1", nil))
+ node.AddAllocation(newAllocation(appID1, "1", nodeID1, nil))
+ node.AddAllocation(newAllocation(appID1, "2", nodeID1, nil))
assert.Equal(t, 2, len(node.GetAllAllocations()), "allocation length mismatch")
// This should not happen in real code just making sure the code does do what is expected
- node.AddAllocation(newAllocation(appID1, "2", nodeID1, "queue-1", nil))
+ node.AddAllocation(newAllocation(appID1, "2", nodeID1, nil))
assert.Equal(t, 2, len(node.GetAllAllocations()), "allocation length mismatch")
}
diff --git a/pkg/scheduler/objects/nodesorting_test.go b/pkg/scheduler/objects/nodesorting_test.go
index 98d2d7e1..a046d2b9 100644
--- a/pkg/scheduler/objects/nodesorting_test.go
+++ b/pkg/scheduler/objects/nodesorting_test.go
@@ -171,11 +171,11 @@ func TestSortPolicyWeighting(t *testing.T) {
// add allocations
res1 := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 500, "memory": 12000})
- alloc1 := newAllocation("test-app-1", uuid.NewString(), "test1", "root.default", res1)
+ alloc1 := newAllocation("test-app-1", uuid.NewString(), "test1", res1)
node1.AddAllocation(alloc1)
res2 := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 1500, "memory": 4000})
- alloc2 := newAllocation("test-app-1", uuid.NewString(), "test2", "root.default", res2)
+ alloc2 := newAllocation("test-app-1", uuid.NewString(), "test2", res2)
node2.AddAllocation(alloc2)
// node1 w/ fair: 25% vcore, 75% memory => ((.25 * 4) + (.75 * 1)) / 5 = 0.35
@@ -262,7 +262,7 @@ func TestSortPolicy(t *testing.T) {
// add allocation to second node
half := resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 1000, "memory": 2000})
- alloc := newAllocation("test-app-1", uuid.NewString(), "test2", "root.default", half)
+ alloc := newAllocation("test-app-1", uuid.NewString(), "test2", half)
node2.AddAllocation(alloc)
// node2 should now be first as it is the highest-loaded
diff --git a/pkg/scheduler/objects/queue_test.go b/pkg/scheduler/objects/queue_test.go
index e59c1824..5f61e1b1 100644
--- a/pkg/scheduler/objects/queue_test.go
+++ b/pkg/scheduler/objects/queue_test.go
@@ -700,7 +700,7 @@ func TestSortAppsWithPlaceholderAllocations(t *testing.T) {
res, err := resources.NewResourceFromConf(map[string]string{"first": "1"})
assert.NilError(t, err, "failed to create basic resource")
- alloc := newAllocation(appID1, "uuid-0", "node-0", "root.leaf", res)
+ alloc := newAllocation(appID1, "uuid-0", "node-0", res)
alloc.placeholder = true
// adding a placeholder allocation & pending request to "app1"
app1.AddAllocation(alloc)
@@ -712,7 +712,7 @@ func TestSortAppsWithPlaceholderAllocations(t *testing.T) {
assert.Equal(t, 1, len(phApps))
// adding a placeholder allocation & pending request to "app2"
- alloc2 := newAllocation(appID2, "uuid-1", "node-1", "root.leaf", res)
+ alloc2 := newAllocation(appID2, "uuid-1", "node-1", res)
alloc2.placeholder = true
app2.AddAllocation(alloc2)
err = app2.AddAllocationAsk(newAllocationAsk("ask-0", appID1, res))
diff --git a/pkg/scheduler/objects/utilities_test.go b/pkg/scheduler/objects/utilities_test.go
index 5812414b..f527dd1d 100644
--- a/pkg/scheduler/objects/utilities_test.go
+++ b/pkg/scheduler/objects/utilities_test.go
@@ -208,14 +208,14 @@ func newProto(nodeID string, totalResource, occupiedResource *resources.Resource
}
// Create a new Allocation with a random ask key
-func newAllocation(appID, uuid, nodeID, queueName string, res *resources.Resource) *Allocation {
+func newAllocation(appID, uuid, nodeID string, res *resources.Resource) *Allocation {
askKey := strconv.FormatInt((time.Now()).UnixNano(), 10)
ask := newAllocationAsk(askKey, appID, res)
return NewAllocation(uuid, nodeID, instType1, ask)
}
// Create a new Allocation with a random ask key
-func newPlaceholderAlloc(appID, uuid, nodeID, queueName string, res *resources.Resource) *Allocation {
+func newPlaceholderAlloc(appID, uuid, nodeID string, res *resources.Resource) *Allocation {
askKey := strconv.FormatInt((time.Now()).UnixNano(), 10)
ask := newAllocationAsk(askKey, appID, res)
ask.placeholder = true
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org