diff --git a/internal/scheduler/context/context_test.go b/internal/scheduler/context/context_test.go index 3443ad63679..05e17c24068 100644 --- a/internal/scheduler/context/context_test.go +++ b/internal/scheduler/context/context_test.go @@ -82,7 +82,7 @@ func testNSmallCpuJobSchedulingContext(queue, priorityClassName string, n int) [ } func testSmallCpuJobSchedulingContext(queue, priorityClassName string) *JobSchedulingContext { - job := testfixtures.Test1CpuJob(queue, priorityClassName) + job := testfixtures.Test1Cpu4GiJob(queue, priorityClassName) return &JobSchedulingContext{ JobId: job.GetId(), Job: job, diff --git a/internal/scheduler/gang_scheduler_test.go b/internal/scheduler/gang_scheduler_test.go index 40b23b2d4f6..6fc67fc4bb7 100644 --- a/internal/scheduler/gang_scheduler_test.go +++ b/internal/scheduler/gang_scheduler_test.go @@ -37,7 +37,7 @@ func TestGangScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: testfixtures.IntRange(0, 0), }, @@ -45,7 +45,7 @@ func TestGangScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), }, ExpectedScheduledIndices: nil, }, @@ -53,8 +53,8 @@ func TestGangScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: testfixtures.IntRange(0, 0), }, @@ -62,7 +62,7 @@ func TestGangScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64), }, ExpectedScheduledIndices: testfixtures.IntRange(0, 0), }, @@ -73,9 +73,9 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 8), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 16), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 8), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 8), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 16), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 8), }, ExpectedScheduledIndices: []int{0, 1}, }, @@ -89,11 +89,11 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: []int{0, 1, 2}, }, @@ -107,11 +107,11 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: []int{0, 1, 2, 3}, }, @@ -127,14 +127,14 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 2), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 4), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 4), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 5), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 4), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 4), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 5), }, ExpectedScheduledIndices: []int{0, 2, 4, 6}, }, @@ -148,12 +148,12 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(3, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: testfixtures.IntRange(0, 5), }, @@ -167,10 +167,10 @@ func TestGangScheduler(t *testing.T) { ), Nodes: testfixtures.N32CpuNodes(3, testfixtures.TestPriorities), Gangs: [][]*jobdb.Job{ - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: testfixtures.IntRange(0, 2), }, diff --git a/internal/scheduler/nodedb/nodedb_test.go b/internal/scheduler/nodedb/nodedb_test.go index a41148ad157..17b6f0dfbc4 100644 --- a/internal/scheduler/nodedb/nodedb_test.go +++ b/internal/scheduler/nodedb/nodedb_test.go @@ -71,7 +71,7 @@ func TestSelectNodeForPod_NodeIdLabel_Success(t *testing.T) { require.NoError(t, err) jobs := testfixtures.WithNodeSelectorJobs( map[string]string{schedulerconfig.NodeIdLabel: nodeId}, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ) jctxs := schedulercontext.JobSchedulingContextsFromJobs(testfixtures.TestPriorityClasses, jobs) for _, jctx := range jctxs { @@ -98,7 +98,7 @@ func TestSelectNodeForPod_NodeIdLabel_Failure(t *testing.T) { require.NoError(t, err) jobs := testfixtures.WithNodeSelectorJobs( map[string]string{schedulerconfig.NodeIdLabel: "this node does not exist"}, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ) jctxs := schedulercontext.JobSchedulingContextsFromJobs(testfixtures.TestPriorityClasses, jobs) for _, jctx := range jctxs { @@ -263,12 +263,12 @@ func TestScheduleIndividually(t *testing.T) { }{ "all jobs fit": { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ExpectSuccess: testfixtures.Repeat(true, 32), }, "not all jobs fit": { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), ExpectSuccess: append(testfixtures.Repeat(true, 32), testfixtures.Repeat(false, 1)...), }, "unavailable resource": { @@ -284,7 +284,7 @@ func TestScheduleIndividually(t *testing.T) { "gibberish": resource.MustParse("1"), }, }, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ), ExpectSuccess: testfixtures.Repeat(false, 1), }, @@ -292,10 +292,10 @@ func TestScheduleIndividually(t *testing.T) { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: append( append( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32)..., + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32)..., ), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32)..., + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32)..., ), ExpectSuccess: append(testfixtures.Repeat(true, 64), testfixtures.Repeat(false, 32)...), }, @@ -303,10 +303,10 @@ func TestScheduleIndividually(t *testing.T) { Nodes: testfixtures.NTainted32CpuNodes(1, testfixtures.TestPriorities), Jobs: append( append( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N1GpuJobs("A", testfixtures.PriorityClass0, 1)..., ), - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)..., + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)..., ), ExpectSuccess: []bool{false, false, true}, }, @@ -324,7 +324,7 @@ func TestScheduleIndividually(t *testing.T) { map[string]string{ "key": "value", }, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), ), ExpectSuccess: append(testfixtures.Repeat(true, 32), testfixtures.Repeat(false, 1)...), }, @@ -339,7 +339,7 @@ func TestScheduleIndividually(t *testing.T) { map[string]string{ "key": "this is the wrong value", }, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ), ExpectSuccess: testfixtures.Repeat(false, 1), }, @@ -349,7 +349,7 @@ func TestScheduleIndividually(t *testing.T) { map[string]string{ "this label does not exist": "value", }, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ), ExpectSuccess: testfixtures.Repeat(false, 1), }, @@ -375,7 +375,7 @@ func TestScheduleIndividually(t *testing.T) { }, }, }, - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), ), ExpectSuccess: append(testfixtures.Repeat(true, 32), testfixtures.Repeat(false, 1)...), }, @@ -432,20 +432,20 @@ func TestScheduleMany(t *testing.T) { }{ "simple success": { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: [][]*jobdb.Job{testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32)}, + Jobs: [][]*jobdb.Job{testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32)}, ExpectSuccess: []bool{true}, }, "simple failure": { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: [][]*jobdb.Job{testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33)}, + Jobs: [][]*jobdb.Job{testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33)}, ExpectSuccess: []bool{false}, }, "correct rollback": { Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), Jobs: [][]*jobdb.Job{ - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectSuccess: []bool{true, false, true}, }, @@ -453,10 +453,10 @@ func TestScheduleMany(t *testing.T) { Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), Jobs: [][]*jobdb.Job{ append( - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32)..., + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32)..., ), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectSuccess: []bool{true, false}, }, @@ -541,7 +541,7 @@ func BenchmarkScheduleMany10CpuNodes320SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 320), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 320), ) } @@ -549,7 +549,7 @@ func BenchmarkScheduleMany10CpuNodes640SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 640), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 640), ) } @@ -557,7 +557,7 @@ func BenchmarkScheduleMany100CpuNodes3200SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(100, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 3200), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 3200), ) } @@ -565,7 +565,7 @@ func BenchmarkScheduleMany100CpuNodes6400SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(100, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 6400), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 6400), ) } @@ -573,7 +573,7 @@ func BenchmarkScheduleMany1000CpuNodes32000SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(1000, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32000), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32000), ) } @@ -581,7 +581,7 @@ func BenchmarkScheduleMany1000CpuNodes64000SmallJobs(b *testing.B) { benchmarkScheduleMany( b, testfixtures.N32CpuNodes(1000, testfixtures.TestPriorities), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64000), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64000), ) } @@ -593,7 +593,7 @@ func BenchmarkScheduleMany100CpuNodes1CpuUnused(b *testing.B) { schedulerobjects.ResourceList{Resources: map[string]resource.Quantity{"cpu": resource.MustParse("31")}}, testfixtures.N32CpuNodes(100, testfixtures.TestPriorities), ), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 100), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 100), ) } @@ -605,7 +605,7 @@ func BenchmarkScheduleMany1000CpuNodes1CpuUnused(b *testing.B) { schedulerobjects.ResourceList{Resources: map[string]resource.Quantity{"cpu": resource.MustParse("31")}}, testfixtures.N32CpuNodes(1000, testfixtures.TestPriorities), ), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1000), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1000), ) } @@ -617,7 +617,7 @@ func BenchmarkScheduleMany10000CpuNodes1CpuUnused(b *testing.B) { schedulerobjects.ResourceList{Resources: map[string]resource.Quantity{"cpu": resource.MustParse("31")}}, testfixtures.N32CpuNodes(10000, testfixtures.TestPriorities), ), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10000), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10000), ) } diff --git a/internal/scheduler/preempting_queue_scheduler_test.go b/internal/scheduler/preempting_queue_scheduler_test.go index 39748894585..72af389657b 100644 --- a/internal/scheduler/preempting_queue_scheduler_test.go +++ b/internal/scheduler/preempting_queue_scheduler_test.go @@ -31,8 +31,8 @@ func TestEvictOversubscribed(t *testing.T) { node := nodes[0] var err error jobs := append( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 20), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 20)..., + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 20), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 20)..., ) for _, job := range jobs { node, err = nodedb.BindJobToNode(testfixtures.TestPriorityClasses, job, node) @@ -125,7 +125,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -133,7 +133,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 15), @@ -146,7 +146,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 10), + "C": testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "C": testfixtures.IntRange(0, 9), @@ -163,9 +163,9 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // The system should be in steady-state; nothing should be scheduled/preempted. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 1), - "C": testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 1), + "C": testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 1), }, }, }, @@ -181,7 +181,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -189,7 +189,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 20), @@ -203,8 +203,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // The system should be in steady-state; nothing should be scheduled/preempted. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 1), }, }, }, @@ -219,7 +219,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -227,7 +227,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 20), @@ -241,8 +241,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // The system should be in steady-state; nothing should be scheduled/preempted. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 1), }, }, }, @@ -259,7 +259,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -267,7 +267,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 31), @@ -286,7 +286,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 31), @@ -294,7 +294,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -313,7 +313,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 33), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 33), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 31), @@ -321,7 +321,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass3, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass3, 1), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 0), @@ -334,7 +334,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 1), }, }, {}, // Empty round to make sure nothing changes. @@ -350,7 +350,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -359,7 +359,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // These should all be scheduled onto the second node with no preemptions necessary. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -376,7 +376,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -384,7 +384,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -393,7 +393,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // This job should preempt the priority-0 jobs. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass2, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass2, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -415,7 +415,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -424,7 +424,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // These should all be scheduled onto the second node with no preemptions necessary. JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N32CpuJobs("B", testfixtures.PriorityClass0, 1), + "B": testfixtures.N32Cpu256GiJobs("B", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 0), @@ -433,7 +433,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // These should all be scheduled onto the second node with no preemptions necessary. JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.N32CpuJobs("C", testfixtures.PriorityClass2, 1), + "C": testfixtures.N32Cpu256GiJobs("C", testfixtures.PriorityClass2, 1), }, ExpectedScheduledIndices: map[string][]int{ "C": testfixtures.IntRange(0, 0), @@ -442,7 +442,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // These should all be scheduled onto the second node with no preemptions necessary. JobsByQueue: map[string][]*jobdb.Job{ - "D": testfixtures.N32CpuJobs("D", testfixtures.PriorityClass3, 1), + "D": testfixtures.N32Cpu256GiJobs("D", testfixtures.PriorityClass3, 1), }, ExpectedScheduledIndices: map[string][]int{ "D": testfixtures.IntRange(0, 0), @@ -468,8 +468,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // Fill half of node 1 and half of node 2. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 16), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 16), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 16), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 16), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 15), @@ -479,7 +479,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // Schedule a gang filling the remaining space on both nodes. JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.WithGangAnnotationsJobs(testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 32)), + "C": testfixtures.WithGangAnnotationsJobs(testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 32)), }, ExpectedScheduledIndices: map[string][]int{ "C": testfixtures.IntRange(0, 31), @@ -489,7 +489,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { // Schedule jobs that requires preempting one job in the gang, // and assert that all jobs in the gang are preempted. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 17), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 17), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 16), @@ -514,7 +514,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // Schedule a gang across two nodes. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.WithGangAnnotationsJobs(testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2)), + "A": testfixtures.WithGangAnnotationsJobs(testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2)), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 1), @@ -547,7 +547,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { // to avoid them being urgency-preempted in the next round. JobsByQueue: map[string][]*jobdb.Job{ "A": testfixtures.WithGangAnnotationsJobs( - append(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1)...), + append(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1)...), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -558,7 +558,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { // Schedule a that requires preempting one job in the gang, // and assert that all jobs in the gang are preempted. JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N32CpuJobs("B", testfixtures.PriorityClass1, 1), + "B": testfixtures.N32Cpu256GiJobs("B", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 0), @@ -585,7 +585,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { // Schedule a gang spanning nodes 1 and 2. JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.WithGangAnnotationsJobs(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 33)), + "A": testfixtures.WithGangAnnotationsJobs(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 33)), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 32), @@ -596,7 +596,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { // Make the one job landing on node 3 have priority 0, so it will be urgency-preempted next. JobsByQueue: map[string][]*jobdb.Job{ "A": testfixtures.WithGangAnnotationsJobs( - append(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 31), testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1)...), + append(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 31), testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1)...), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -607,7 +607,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { // Schedule a job that requires preempting the one job on node 3. // Assert that the entire second gang is preempted and that the first gang isn't. JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N32CpuJobs("B", testfixtures.PriorityClass1, 1), + "B": testfixtures.N32Cpu256GiJobs("B", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 0), @@ -630,7 +630,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 4), @@ -638,7 +638,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 4), @@ -655,7 +655,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 1), @@ -663,7 +663,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 4), @@ -685,7 +685,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 5), @@ -693,7 +693,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 5), @@ -710,7 +710,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -718,7 +718,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -740,7 +740,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + "A": testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -748,7 +748,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N32CpuJobs("B", testfixtures.PriorityClass1, 1), + "B": testfixtures.N32Cpu256GiJobs("B", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 0), @@ -771,7 +771,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": append(testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1)...), + "A": append(testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1)...), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(1, 1), @@ -789,9 +789,9 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": append(append( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 10)...), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 10)..., + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 10)...), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 10)..., ), }, ExpectedScheduledIndices: map[string][]int{ @@ -800,7 +800,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 24), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 24), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 23), @@ -831,11 +831,11 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -844,7 +844,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), }, }, }, @@ -867,7 +867,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -877,8 +877,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -888,9 +888,9 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -900,10 +900,10 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -913,10 +913,10 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 32), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ), }, }, @@ -934,7 +934,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 64), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 64), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 15), @@ -942,8 +942,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 64), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 64), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 15), @@ -951,8 +951,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 64), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 64), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 7), @@ -961,8 +961,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 64), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 64), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 7), @@ -981,8 +981,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass1, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass1, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 31), @@ -1001,8 +1001,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass1, 31), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass1, 31), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -1022,8 +1022,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass3, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass3, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 31), @@ -1042,7 +1042,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 16), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 16), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 15), @@ -1050,8 +1050,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 16), - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass1, 32), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 16), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass1, 32), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 15), @@ -1074,8 +1074,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "A": armadaslices.Concatenate( - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass2, 1), - testfixtures.N16CpuJobs("A", testfixtures.PriorityClass2NonPreemptible, 3), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass2, 1), + testfixtures.N16Cpu128GiJobs("A", testfixtures.PriorityClass2NonPreemptible, 3), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -1085,8 +1085,8 @@ func TestPreemptingQueueScheduler(t *testing.T) { { JobsByQueue: map[string][]*jobdb.Job{ "B": armadaslices.Concatenate( - testfixtures.N16CpuJobs("B", testfixtures.PriorityClass3, 1), - testfixtures.N16CpuJobs("B", testfixtures.PriorityClass2NonPreemptible, 1), + testfixtures.N16Cpu128GiJobs("B", testfixtures.PriorityClass3, 1), + testfixtures.N16Cpu128GiJobs("B", testfixtures.PriorityClass2NonPreemptible, 1), ), }, ExpectedScheduledIndices: map[string][]int{ @@ -1111,7 +1111,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 1), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 1), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 0), @@ -1119,13 +1119,13 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass1, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass1, 1), }, NodeIndicesToCordon: []int{0}, }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass1, 1), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass1, 1), }, }, {}, // Empty round to make sure nothing changes. @@ -1144,7 +1144,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 10), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 9), @@ -1152,7 +1152,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass3, 22), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass3, 22), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 21), @@ -1160,7 +1160,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 1), + "C": testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 1), }, }, {}, // Empty round to make sure nothing changes. @@ -1180,7 +1180,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 8), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 8), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 7), @@ -1188,7 +1188,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass3, 24), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass3, 24), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 23), @@ -1196,7 +1196,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 1), + "C": testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 1), }, }, {}, // Empty round to make sure nothing changes. @@ -1216,7 +1216,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { Rounds: []SchedulingRound{ { JobsByQueue: map[string][]*jobdb.Job{ - "A": testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 9), + "A": testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 9), }, ExpectedScheduledIndices: map[string][]int{ "A": testfixtures.IntRange(0, 8), @@ -1224,7 +1224,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "B": testfixtures.N1CpuJobs("B", testfixtures.PriorityClass3, 23), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass3, 23), }, ExpectedScheduledIndices: map[string][]int{ "B": testfixtures.IntRange(0, 22), @@ -1232,7 +1232,7 @@ func TestPreemptingQueueScheduler(t *testing.T) { }, { JobsByQueue: map[string][]*jobdb.Job{ - "C": testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 1), + "C": testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 1), }, ExpectedScheduledIndices: map[string][]int{ "C": testfixtures.IntRange(0, 0), @@ -1251,6 +1251,29 @@ func TestPreemptingQueueScheduler(t *testing.T) { "C": 1, }, }, + "DominantResourceFairness": { + SchedulingConfig: testfixtures.WithDominantResourceFairnessConfig( + testfixtures.TestSchedulingConfig(), + ), + Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), + Rounds: []SchedulingRound{ + { + JobsByQueue: map[string][]*jobdb.Job{ + "A": testfixtures.N1Cpu16GiJobs("A", testfixtures.PriorityClass0, 32), + "B": testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), + }, + ExpectedScheduledIndices: map[string][]int{ + "A": testfixtures.IntRange(0, 9), + "B": testfixtures.IntRange(0, 21), + }, + }, + {}, // Empty round to make sure nothing changes. + }, + PriorityFactorByQueue: map[string]float64{ + "A": 1, + "B": 1, + }, + }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { @@ -1334,6 +1357,9 @@ func TestPreemptingQueueScheduler(t *testing.T) { tc.SchedulingConfig.ResourceScarcity, tc.TotalResources, ) + if tc.SchedulingConfig.FairnessModel == configuration.DominantResourceFairness { + sctx.EnableDominantResourceFairness(tc.SchedulingConfig.DominantResourceFairnessResourcesToConsider) + } for queue, priorityFactor := range tc.PriorityFactorByQueue { weight := 1 / priorityFactor err := sctx.AddQueueSchedulingContext(queue, weight, allocatedByQueueAndPriorityClass[queue]) @@ -1497,7 +1523,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "1 node 1 queue 320 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 1, NumJobsPerQueue: 320, MinPriorityFactor: 1, @@ -1506,7 +1532,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "1 node 10 queues 320 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 10, NumJobsPerQueue: 320, MinPriorityFactor: 1, @@ -1515,7 +1541,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "10 nodes 1 queue 3200 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(10, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 1, NumJobsPerQueue: 3200, MinPriorityFactor: 1, @@ -1524,7 +1550,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "10 nodes 10 queues 3200 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(10, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 10, NumJobsPerQueue: 3200, MinPriorityFactor: 1, @@ -1533,7 +1559,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "100 nodes 1 queue 32000 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(100, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 1, NumJobsPerQueue: 32000, MinPriorityFactor: 1, @@ -1542,7 +1568,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "100 nodes 10 queues 32000 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(100, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 10, NumJobsPerQueue: 32000, MinPriorityFactor: 1, @@ -1551,7 +1577,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "1000 nodes 1 queue 320000 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1000, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 1, NumJobsPerQueue: 320000, MinPriorityFactor: 1, @@ -1560,7 +1586,7 @@ func BenchmarkPreemptingQueueScheduler(b *testing.B) { "1000 nodes 10 queues 320000 jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1000, testfixtures.TestPriorities), - JobFunc: testfixtures.N1CpuJobs, + JobFunc: testfixtures.N1Cpu4GiJobs, NumQueues: 1, NumJobsPerQueue: 32000, MinPriorityFactor: 1, diff --git a/internal/scheduler/queue_scheduler_test.go b/internal/scheduler/queue_scheduler_test.go index 0c0348179b2..66a9009d486 100644 --- a/internal/scheduler/queue_scheduler_test.go +++ b/internal/scheduler/queue_scheduler_test.go @@ -48,41 +48,41 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), PriorityFactorByQueue: map[string]float64{"A": 1.0}, Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ExpectedScheduledIndices: testfixtures.IntRange(0, 31), }, "simple failure": { SchedulingConfig: testfixtures.TestSchedulingConfig(), PriorityFactorByQueue: map[string]float64{"A": 1.0}, Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 33), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 33), ExpectedScheduledIndices: testfixtures.IntRange(0, 31), }, "multiple nodes": { SchedulingConfig: testfixtures.TestSchedulingConfig(), PriorityFactorByQueue: map[string]float64{"A": 1.0}, Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 64), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 64), ExpectedScheduledIndices: testfixtures.IntRange(0, 63), }, "preempt lower-priority jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: testfixtures.IntRange(0, 1), }, "no preemption of higher-priority jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: testfixtures.IntRange(0, 0), }, "unschedulable jobs do not block schedulable jobs": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 10), testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 10), testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0, 11}, }, @@ -90,9 +90,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.WithMaxJobsToScheduleConfig(2, testfixtures.TestSchedulingConfig()), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 10), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 10), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 3), ), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0, 11}, @@ -103,22 +103,22 @@ func TestQueueScheduler(t *testing.T) { Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( testfixtures.WithGangAnnotationsJobs( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), ), testfixtures.WithGangAnnotationsJobs( - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2), ), testfixtures.WithGangAnnotationsJobs( - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2), ), testfixtures.WithGangAnnotationsJobs( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), ), testfixtures.WithGangAnnotationsJobs( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), ), testfixtures.WithGangAnnotationsJobs( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), ), ), PriorityFactorByQueue: map[string]float64{"A": 1}, @@ -132,7 +132,7 @@ func TestQueueScheduler(t *testing.T) { ), PriorityFactorByQueue: map[string]float64{"A": 1.0}, Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), ExpectedScheduledIndices: testfixtures.IntRange(0, 16), ExpectedNeverAttemptedIndices: testfixtures.IntRange(17, 31), }, @@ -149,15 +149,15 @@ func TestQueueScheduler(t *testing.T) { PriorityFactorByQueue: map[string]float64{"A": 1.0}, Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 2), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass1, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass2, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 4), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass3, 4), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 2), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass1, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass2, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 4), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass3, 4), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ), ExpectedScheduledIndices: armadaslices.Concatenate( testfixtures.IntRange(0, 0), @@ -169,7 +169,7 @@ func TestQueueScheduler(t *testing.T) { "fairness two queues": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32)), PriorityFactorByQueue: map[string]float64{"A": 1, "B": 1}, ExpectedScheduledIndices: armadaslices.Concatenate(testfixtures.IntRange(0, 15), testfixtures.IntRange(32, 47)), }, @@ -177,9 +177,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 32), ), PriorityFactorByQueue: map[string]float64{ "A": 1, @@ -196,8 +196,8 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(3, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 96), - testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 96), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 96), + testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 96), ), PriorityFactorByQueue: map[string]float64{ "A": 1, @@ -212,9 +212,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(3, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 96), - testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 96), - testfixtures.N1CpuJobs("C", testfixtures.PriorityClass0, 96), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 96), + testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 96), + testfixtures.N1Cpu4GiJobs("C", testfixtures.PriorityClass0, 96), ), PriorityFactorByQueue: map[string]float64{ "A": 1, @@ -231,8 +231,8 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 32), - testfixtures.N1CpuJobs("B", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 32), + testfixtures.N1Cpu4GiJobs("B", testfixtures.PriorityClass0, 32), ), PriorityFactorByQueue: map[string]float64{ "A": 1, @@ -260,7 +260,7 @@ func TestQueueScheduler(t *testing.T) { }, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), ), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: nil, }, @@ -275,7 +275,7 @@ func TestQueueScheduler(t *testing.T) { }, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), ), - Jobs: testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 2), + Jobs: testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 2), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0}, }, @@ -290,21 +290,21 @@ func TestQueueScheduler(t *testing.T) { }, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), ), - Jobs: testfixtures.N32CpuJobs("A", testfixtures.PriorityClass1, 1), + Jobs: testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass1, 1), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0}, }, "respect taints": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.NTainted32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{1}, }, "minimum job size": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, MinimumJobSize: map[string]resource.Quantity{ "cpu": resource.MustParse("2"), @@ -315,8 +315,8 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N8GpuNodes(2, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N1GpuJobs("A", testfixtures.PriorityClass0, 1), ), PriorityFactorByQueue: map[string]float64{"A": 1}, @@ -329,8 +329,8 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N8GpuNodes(2, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N1GpuJobs("A", testfixtures.PriorityClass0, 1), ), PriorityFactorByQueue: map[string]float64{"A": 1}, @@ -342,7 +342,7 @@ func TestQueueScheduler(t *testing.T) { "taints and tolerations": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.NTainted32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{1}, }, @@ -352,14 +352,14 @@ func TestQueueScheduler(t *testing.T) { testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), testfixtures.WithLabelsNodes(map[string]string{"foo": "foo"}, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities)), ), - Jobs: testfixtures.WithNodeSelectorJobs(map[string]string{"foo": "foo"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2)), + Jobs: testfixtures.WithNodeSelectorJobs(map[string]string{"foo": "foo"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0}, }, "taints and tolerations (indexed)": { SchedulingConfig: testfixtures.WithIndexedTaintsConfig([]string{"largeJobsOnly"}, testfixtures.TestSchedulingConfig()), Nodes: testfixtures.NTainted32CpuNodes(1, testfixtures.TestPriorities), - Jobs: armadaslices.Concatenate(testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + Jobs: armadaslices.Concatenate(testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{1}, }, @@ -369,7 +369,7 @@ func TestQueueScheduler(t *testing.T) { testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), testfixtures.WithLabelsNodes(map[string]string{"foo": "foo"}, testfixtures.N32CpuNodes(1, testfixtures.TestPriorities))..., ), - Jobs: testfixtures.WithNodeSelectorJobs(map[string]string{"foo": "foo"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2)), + Jobs: testfixtures.WithNodeSelectorJobs(map[string]string{"foo": "foo"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0}, }, @@ -377,9 +377,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.WithMaxQueueLookbackConfig(3, testfixtures.TestSchedulingConfig()), Nodes: testfixtures.N32CpuNodes(1, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 3), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 3), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), ), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0}, @@ -388,7 +388,7 @@ func TestQueueScheduler(t *testing.T) { "gang success": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), - Jobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 2)), + Jobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 2)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0, 1}, }, @@ -396,9 +396,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(3, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), ), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{0, 1, 2}, @@ -406,7 +406,7 @@ func TestQueueScheduler(t *testing.T) { "gang failure": { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), - Jobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 3)), + Jobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 3)), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: nil, }, @@ -414,9 +414,9 @@ func TestQueueScheduler(t *testing.T) { SchedulingConfig: testfixtures.TestSchedulingConfig(), Nodes: testfixtures.N32CpuNodes(2, testfixtures.TestPriorities), Jobs: armadaslices.Concatenate( - testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), - testfixtures.N1CpuJobs("A", testfixtures.PriorityClass0, 1), - testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32CpuJobs("A", testfixtures.PriorityClass0, 1)), + testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), + testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1), + testfixtures.WithAnnotationsJobs(map[string]string{configuration.GangIdAnnotation: "my-gang", configuration.GangCardinalityAnnotation: "2"}, testfixtures.N32Cpu256GiJobs("A", testfixtures.PriorityClass0, 1)), ), PriorityFactorByQueue: map[string]float64{"A": 1}, ExpectedScheduledIndices: []int{1}, diff --git a/internal/scheduler/scheduling_algo_test.go b/internal/scheduler/scheduling_algo_test.go index f1553272c74..88631804158 100644 --- a/internal/scheduler/scheduling_algo_test.go +++ b/internal/scheduler/scheduling_algo_test.go @@ -49,7 +49,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: map[string][]int{ "executor1": {0, 1}, "executor2": {2, 3}, @@ -64,7 +64,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: map[string][]int{ "executor1": {0, 1}, }, @@ -78,12 +78,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - existingJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), + existingJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), existingUnacknowledgedIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: map[string][]int{ "executor2": {0, 1}, @@ -98,12 +98,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - existingJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), + existingJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: map[string][]int{ "executor2": {0, 1}, @@ -123,12 +123,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - existingJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), + existingJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 2), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: nil, }, @@ -146,12 +146,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{testfixtures.TestDbQueue()}, - existingJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 1), + existingJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 1), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0}}, }, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: map[string][]int{ "executor1": {0}, @@ -174,7 +174,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{}, queues: []*database.Queue{testfixtures.TestDbQueue()}, - queuedJobs: testfixtures.N16CpuJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), + queuedJobs: testfixtures.N16Cpu128GiJobs(testfixtures.TestQueue, testfixtures.PriorityClass3, 10), expectedScheduledIndices: nil, }, "computation of allocated resources does not confuse priority class with per-queue priority": { @@ -188,7 +188,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{testfixtures.TestDbQueue()}, - existingJobs: []*jobdb.Job{testfixtures.Test16CpuJob(testfixtures.TestQueue, testfixtures.PriorityClass3).WithPriority(0)}, + existingJobs: []*jobdb.Job{testfixtures.Test16Cpu128GiJob(testfixtures.TestQueue, testfixtures.PriorityClass3).WithPriority(0)}, existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0}}, }, @@ -199,7 +199,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { // than the priority class number of the two jobs (i.e., 3); if the scheduler were // to use the per-queue priority instead of the priority class number in its // accounting, then it would schedule this job. - testfixtures.Test16CpuJob(testfixtures.TestQueue, testfixtures.PriorityClass3).WithPriority(1), + testfixtures.Test16Cpu128GiJob(testfixtures.TestQueue, testfixtures.PriorityClass3).WithPriority(1), }, expectedScheduledIndices: nil, @@ -210,12 +210,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{{Name: "queue1", Weight: 100}}, - existingJobs: testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2), + existingJobs: testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass1, 2), + queuedJobs: testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass1, 2), expectedPreemptedIndices: []int{0, 1}, expectedScheduledIndices: map[string][]int{ @@ -228,12 +228,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{{Name: "queue1", Weight: 100}, {Name: "queue2", Weight: 100}}, - existingJobs: testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2), + existingJobs: testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs("queue2", testfixtures.PriorityClass1, 2), + queuedJobs: testfixtures.N16Cpu128GiJobs("queue2", testfixtures.PriorityClass1, 2), expectedPreemptedIndices: []int{0, 1}, expectedScheduledIndices: map[string][]int{ @@ -246,12 +246,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{{Name: "queue1", Weight: 100}, {Name: "queue2", Weight: 100}}, - existingJobs: testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2), + existingJobs: testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs("queue2", testfixtures.PriorityClass0, 2), + queuedJobs: testfixtures.N16Cpu128GiJobs("queue2", testfixtures.PriorityClass0, 2), expectedPreemptedIndices: []int{1}, expectedScheduledIndices: map[string][]int{ @@ -264,7 +264,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{{Name: "queue1", Weight: 100}}, - queuedJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2)), + queuedJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2)), expectedScheduledIndices: map[string][]int{ "executor1": {0, 1}, @@ -279,7 +279,7 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{{Name: "queue1", Weight: 100}}, - queuedJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 3)), + queuedJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 3)), expectedScheduledIndices: nil, }, @@ -292,12 +292,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { }, queues: []*database.Queue{{Name: "queue1", Weight: 100}, {Name: "queue2", Weight: 100}}, - existingJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2)), + existingJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2)), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs("queue2", testfixtures.PriorityClass1, 4), + queuedJobs: testfixtures.N16Cpu128GiJobs("queue2", testfixtures.PriorityClass1, 4), expectedPreemptedIndices: []int{0, 1}, expectedScheduledIndices: map[string][]int{ @@ -311,12 +311,12 @@ func TestLegacySchedulingAlgo_TestSchedule(t *testing.T) { executors: []*schedulerobjects.Executor{testfixtures.Test1Node32CoreExecutor("executor1")}, queues: []*database.Queue{{Name: "queue1", Weight: 100}, {Name: "queue2", Weight: 100}}, - existingJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16CpuJobs("queue1", testfixtures.PriorityClass0, 2)), + existingJobs: testfixtures.WithGangAnnotationsJobs(testfixtures.N16Cpu128GiJobs("queue1", testfixtures.PriorityClass0, 2)), existingRunningIndices: map[string]map[string][]int{ "executor1": {"executor1-node": {0, 1}}, }, - queuedJobs: testfixtures.N16CpuJobs("queue2", testfixtures.PriorityClass0, 1), + queuedJobs: testfixtures.N16Cpu128GiJobs("queue2", testfixtures.PriorityClass0, 1), expectedPreemptedIndices: []int{0, 1}, expectedScheduledIndices: map[string][]int{ diff --git a/internal/scheduler/submitcheck_test.go b/internal/scheduler/submitcheck_test.go index 49c0dfb1bc2..a95f3d9abbf 100644 --- a/internal/scheduler/submitcheck_test.go +++ b/internal/scheduler/submitcheck_test.go @@ -38,35 +38,35 @@ func TestSubmitChecker_CheckJobDbJobs(t *testing.T) { executorTimout: defaultTimeout, config: testfixtures.TestSchedulingConfig(), executors: []*schedulerobjects.Executor{testExecutor(baseTime)}, - job: testfixtures.Test1CpuJob("queue", testfixtures.PriorityClass1), + job: testfixtures.Test1Cpu4GiJob("queue", testfixtures.PriorityClass1), expectPass: true, }, "no jobs schedule due to resources": { executorTimout: defaultTimeout, config: testfixtures.TestSchedulingConfig(), executors: []*schedulerobjects.Executor{testExecutor(baseTime)}, - job: testfixtures.Test32CpuJob("queue", testfixtures.PriorityClass1), + job: testfixtures.Test32Cpu256GiJob("queue", testfixtures.PriorityClass1), expectPass: false, }, "no jobs schedule due to selector": { executorTimout: defaultTimeout, config: testfixtures.TestSchedulingConfig(), executors: []*schedulerobjects.Executor{testExecutor(baseTime)}, - job: testfixtures.WithNodeSelectorJob(map[string]string{"foo": "bar"}, testfixtures.Test1CpuJob("queue", testfixtures.PriorityClass1)), + job: testfixtures.WithNodeSelectorJob(map[string]string{"foo": "bar"}, testfixtures.Test1Cpu4GiJob("queue", testfixtures.PriorityClass1)), expectPass: false, }, "no jobs schedule due to executor timeout": { executorTimout: defaultTimeout, config: testfixtures.TestSchedulingConfig(), executors: []*schedulerobjects.Executor{testExecutor(expiredTime)}, - job: testfixtures.Test1CpuJob("queue", testfixtures.PriorityClass1), + job: testfixtures.Test1Cpu4GiJob("queue", testfixtures.PriorityClass1), expectPass: false, }, "multiple executors, 1 expired": { executorTimout: defaultTimeout, config: testfixtures.TestSchedulingConfig(), executors: []*schedulerobjects.Executor{testExecutor(expiredTime), testExecutor(baseTime)}, - job: testfixtures.Test1CpuJob("queue", testfixtures.PriorityClass1), + job: testfixtures.Test1Cpu4GiJob("queue", testfixtures.PriorityClass1), expectPass: true, }, } diff --git a/internal/scheduler/testfixtures/testfixtures.go b/internal/scheduler/testfixtures/testfixtures.go index c2314992cdd..79b3ffb1be0 100644 --- a/internal/scheduler/testfixtures/testfixtures.go +++ b/internal/scheduler/testfixtures/testfixtures.go @@ -94,7 +94,8 @@ func TestSchedulingConfig() configuration.SchedulingConfig { NodeEvictionProbability: 1.0, NodeOversubscriptionEvictionProbability: 1.0, }, - IndexedResources: TestResources, + IndexedResources: TestResources, + DominantResourceFairnessResourcesToConsider: TestResourceNames, ExecutorTimeout: 15 * time.Minute, MaxUnacknowledgedJobsPerExecutor: math.MaxInt, } @@ -110,6 +111,11 @@ func WithProtectedFractionOfFairShareConfig(v float64, config configuration.Sche return config } +func WithDominantResourceFairnessConfig(config configuration.SchedulingConfig) configuration.SchedulingConfig { + config.FairnessModel = configuration.DominantResourceFairness + return config +} + func WithNodeEvictionProbabilityConfig(p float64, config configuration.SchedulingConfig) configuration.SchedulingConfig { config.Preemption.NodeEvictionProbability = p return config @@ -308,26 +314,34 @@ func WithAnnotationsJobs(annotations map[string]string, jobs []*jobdb.Job) []*jo return jobs } -func N1CpuJobs(queue string, priorityClassName string, n int) []*jobdb.Job { +func N1Cpu4GiJobs(queue string, priorityClassName string, n int) []*jobdb.Job { rv := make([]*jobdb.Job, n) for i := 0; i < n; i++ { - rv[i] = Test1CpuJob(queue, priorityClassName) + rv[i] = Test1Cpu4GiJob(queue, priorityClassName) } return rv } -func N16CpuJobs(queue string, priorityClassName string, n int) []*jobdb.Job { +func N1Cpu16GiJobs(queue string, priorityClassName string, n int) []*jobdb.Job { rv := make([]*jobdb.Job, n) for i := 0; i < n; i++ { - rv[i] = Test16CpuJob(queue, priorityClassName) + rv[i] = Test1Cpu16GiJob(queue, priorityClassName) } return rv } -func N32CpuJobs(queue string, priorityClassName string, n int) []*jobdb.Job { +func N16Cpu128GiJobs(queue string, priorityClassName string, n int) []*jobdb.Job { rv := make([]*jobdb.Job, n) for i := 0; i < n; i++ { - rv[i] = Test32CpuJob(queue, priorityClassName) + rv[i] = Test16Cpu128GiJob(queue, priorityClassName) + } + return rv +} + +func N32Cpu256GiJobs(queue string, priorityClassName string, n int) []*jobdb.Job { + rv := make([]*jobdb.Job, n) + for i := 0; i < n; i++ { + rv[i] = Test32Cpu256GiJob(queue, priorityClassName) } return rv } @@ -377,19 +391,24 @@ func TestJob(queue string, jobId ulid.ULID, priorityClassName string, req *sched ) } -func Test1CpuJob(queue string, priorityClassName string) *jobdb.Job { +func Test1Cpu4GiJob(queue string, priorityClassName string) *jobdb.Job { + jobId := util.ULID() + return TestJob(queue, jobId, priorityClassName, Test1Cpu4GiPodReqs(queue, jobId, extractPriority(priorityClassName))) +} + +func Test1Cpu16GiJob(queue string, priorityClassName string) *jobdb.Job { jobId := util.ULID() - return TestJob(queue, jobId, priorityClassName, Test1CpuPodReqs(queue, jobId, extractPriority(priorityClassName))) + return TestJob(queue, jobId, priorityClassName, Test1Cpu16GiPodReqs(queue, jobId, extractPriority(priorityClassName))) } -func Test16CpuJob(queue string, priorityClassName string) *jobdb.Job { +func Test16Cpu128GiJob(queue string, priorityClassName string) *jobdb.Job { jobId := util.ULID() - return TestJob(queue, jobId, priorityClassName, Test16CpuPodReqs(queue, jobId, extractPriority(priorityClassName))) + return TestJob(queue, jobId, priorityClassName, Test16Cpu128GiPodReqs(queue, jobId, extractPriority(priorityClassName))) } -func Test32CpuJob(queue string, priorityClassName string) *jobdb.Job { +func Test32Cpu256GiJob(queue string, priorityClassName string) *jobdb.Job { jobId := util.ULID() - return TestJob(queue, jobId, priorityClassName, Test32CpuPodReqs(queue, jobId, extractPriority(priorityClassName))) + return TestJob(queue, jobId, priorityClassName, Test32Cpu256GiPodReqs(queue, jobId, extractPriority(priorityClassName))) } func Test1GpuJob(queue string, priorityClassName string) *jobdb.Job { @@ -400,7 +419,7 @@ func Test1GpuJob(queue string, priorityClassName string) *jobdb.Job { func N1CpuPodReqs(queue string, priority int32, n int) []*schedulerobjects.PodRequirements { rv := make([]*schedulerobjects.PodRequirements, n) for i := 0; i < n; i++ { - rv[i] = Test1CpuPodReqs(queue, util.ULID(), priority) + rv[i] = Test1Cpu4GiPodReqs(queue, util.ULID(), priority) } return rv } @@ -408,7 +427,7 @@ func N1CpuPodReqs(queue string, priority int32, n int) []*schedulerobjects.PodRe func N16CpuPodReqs(queue string, priority int32, n int) []*schedulerobjects.PodRequirements { rv := make([]*schedulerobjects.PodRequirements, n) for i := 0; i < n; i++ { - rv[i] = Test16CpuPodReqs(queue, util.ULID(), priority) + rv[i] = Test16Cpu128GiPodReqs(queue, util.ULID(), priority) } return rv } @@ -416,7 +435,7 @@ func N16CpuPodReqs(queue string, priority int32, n int) []*schedulerobjects.PodR func N32CpuPodReqs(queue string, priority int32, n int) []*schedulerobjects.PodRequirements { rv := make([]*schedulerobjects.PodRequirements, n) for i := 0; i < n; i++ { - rv[i] = Test32CpuPodReqs(queue, util.ULID(), priority) + rv[i] = Test32Cpu256GiPodReqs(queue, util.ULID(), priority) } return rv } @@ -438,7 +457,7 @@ func TestPodReqs(queue string, jobId ulid.ULID, priority int32, requests v1.Reso } } -func Test1CpuPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { +func Test1Cpu4GiPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { return TestPodReqs( queue, jobId, @@ -450,7 +469,19 @@ func Test1CpuPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerob ) } -func Test16CpuPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { +func Test1Cpu16GiPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { + return TestPodReqs( + queue, + jobId, + priority, + v1.ResourceList{ + "cpu": resource.MustParse("1"), + "memory": resource.MustParse("16Gi"), + }, + ) +} + +func Test16Cpu128GiPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { req := TestPodReqs( queue, jobId, @@ -469,7 +500,7 @@ func Test16CpuPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulero return req } -func Test32CpuPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { +func Test32Cpu256GiPodReqs(queue string, jobId ulid.ULID, priority int32) *schedulerobjects.PodRequirements { req := TestPodReqs( queue, jobId,