Skip to content

Commit 1b54ff5

Browse files
authored
Deprecate isInferencePreemptible flag and related configuration (#379)
* remove!: deprecate and disable isInferencePreemptible flag Signed-off-by: Saurabh Kumar Singh <[email protected]> * refactor: Remove `IsInferencePreemptible` method for PriorityClass Signed-off-by: Saurabh Kumar Singh <[email protected]> * chore: remove isInferencePreemptible after review Signed-off-by: Saurabh Kumar Singh <[email protected]> * fix: update unit test based on priorities Signed-off-by: Saurabh Kumar Singh <[email protected]> * fix: update unit test after review Signed-off-by: Saurabh Kumar Singh <[email protected]> * chore: rename test cases for clarity Signed-off-by: Saurabh Kumar Singh <[email protected]> --------- Signed-off-by: Saurabh Kumar Singh <[email protected]>
1 parent 967c3a7 commit 1b54ff5

File tree

16 files changed

+27
-47
lines changed

16 files changed

+27
-47
lines changed

cmd/scheduler/app/options/options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ func (s *ServerOption) AddFlags(fs *pflag.FlagSet) {
117117
fs.IntVar(&s.PyroscopeMutexProfilerRate, "pyroscope-mutex-profiler-rate", DefaultPyroscopeMutexProfilerRate, "Mutex Profiler rate")
118118
fs.IntVar(&s.PyroscopeBlockProfilerRate, "pyroscope-block-profiler-rate", DefaultPyroscopeBlockProfilerRate, "Block Profiler rate")
119119
fs.IntVar(&s.Verbosity, "v", defaultVerbosityLevel, "Verbosity level")
120-
fs.BoolVar(&s.IsInferencePreemptible, "inference-preemptible", false, "Consider Inference workloads as preemptible")
121120
fs.IntVar(&s.MaxNumberConsolidationPreemptees, "max-consolidation-preemptees", defaultMaxConsolidationPreemptees, "Maximum number of consolidation preemptees. Defaults to 16")
122121
fs.IntVar(&s.QPS, "qps", 50, "Queries per second to the K8s API server")
123122
fs.IntVar(&s.Burst, "burst", 300, "Burst to the K8s API server")

pkg/scheduler/actions/allocate/allocate_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ func getTestsMetadata() []integration_tests_utils.TestTopologyMetadata {
14671467
},
14681468
{
14691469
TestTopologyBasic: test_utils.TestTopologyBasic{
1470-
Name: "Allocate inference over quota",
1470+
Name: "Attempt to allocate inference over quota",
14711471
Jobs: []*jobs_fake.TestJobBasic{
14721472
{
14731473
Name: "pending_job0",
@@ -1499,8 +1499,8 @@ func getTestsMetadata() []integration_tests_utils.TestTopologyMetadata {
14991499
JobExpectedResults: map[string]test_utils.TestExpectedResultBasic{
15001500
"pending_job0": {
15011501
GPUsRequired: 1,
1502-
Status: pod_status.Binding,
1503-
NodeName: "node0",
1502+
Status: pod_status.Pending,
1503+
NodeName: "",
15041504
},
15051505
},
15061506
Mocks: &test_utils.TestMock{

pkg/scheduler/actions/consolidation/consolidation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func buildPreemptibleFilterFunc(preemptor *podgroup_info.PodGroupInfo, maxPreemp
135135
preempteeJobsCounter := 0
136136

137137
return func(job *podgroup_info.PodGroupInfo) bool {
138-
if !job.IsPreemptibleJob(false) {
138+
if !job.IsPreemptibleJob() {
139139
return false
140140
}
141141

pkg/scheduler/actions/preempt/preempt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func attemptToPreemptForPreemptor(
123123

124124
func buildFilterFuncForPreempt(ssn *framework.Session, preemptor *podgroup_info.PodGroupInfo) func(*podgroup_info.PodGroupInfo) bool {
125125
return func(job *podgroup_info.PodGroupInfo) bool {
126-
if !job.IsPreemptibleJob(ssn.IsInferencePreemptible()) {
126+
if !job.IsPreemptibleJob() {
127127
return false
128128
}
129129

pkg/scheduler/actions/reclaim/reclaim_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ func getTestsMetadata() []integration_tests_utils.TestTopologyMetadata {
25992599
},
26002600
{
26012601
TestTopologyBasic: test_utils.TestTopologyBasic{
2602-
Name: "inference basic reclaim",
2602+
Name: "Attempt to reclaim from an inference workload",
26032603
Jobs: []*jobs_fake.TestJobBasic{
26042604
{
26052605
Name: "q0_job0",
@@ -2662,13 +2662,13 @@ func getTestsMetadata() []integration_tests_utils.TestTopologyMetadata {
26622662
"q0_job1": {
26632663
NodeName: "node0",
26642664
GPUsRequired: 1,
2665-
Status: pod_status.Releasing,
2665+
Status: pod_status.Running,
26662666
DontValidateGPUGroup: true,
26672667
},
26682668
"q1_job0": {
2669-
NodeName: "node0",
2669+
NodeName: "",
26702670
GPUsRequired: 1,
2671-
Status: pod_status.Pipelined,
2671+
Status: pod_status.Pending,
26722672
DontValidateGPUGroup: true,
26732673
},
26742674
},

pkg/scheduler/actions/utils/input_jobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (jobsOrder *JobsOrderByQueues) InitializeWithJobs(
2929
continue
3030
}
3131

32-
if jobsOrder.jobsOrderInitOptions.FilterNonPreemptible && !job.IsPreemptibleJob(jobsOrder.ssn.IsInferencePreemptible()) {
32+
if jobsOrder.jobsOrderInitOptions.FilterNonPreemptible && !job.IsPreemptibleJob() {
3333
continue
3434
}
3535

pkg/scheduler/api/podgroup_info/job_info.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,7 @@ func (pgi *PodGroupInfo) SetDefaultMinAvailable(minAvailable int32) {
164164
pgi.SubGroups[DefaultSubGroup].SetMinAvailable(minAvailable)
165165
}
166166

167-
func (pgi *PodGroupInfo) IsPreemptibleJob(isInferencePreemptible bool) bool {
168-
if isInferencePreemptible {
169-
if pgi.Priority == constants.PriorityInferenceNumber {
170-
return true
171-
}
172-
}
173-
167+
func (pgi *PodGroupInfo) IsPreemptibleJob() bool {
174168
return pgi.Priority < constants.PriorityBuildNumber
175169
}
176170

pkg/scheduler/framework/session.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,6 @@ func (ssn *Session) OverrideMaxNumberConsolidationPreemptees(maxPreemptees int)
392392
ssn.SchedulerParams.MaxNumberConsolidationPreemptees = maxPreemptees
393393
}
394394

395-
func (ssn *Session) IsInferencePreemptible() bool {
396-
return ssn.SchedulerParams.IsInferencePreemptible
397-
}
398-
399-
// OverrideInferencePreemptible overrides the value returned by IsInferencePreemptible. Use for testing purposes.
400-
func (ssn *Session) OverrideInferencePreemptible(isInferencePreemptible bool) {
401-
ssn.SchedulerParams.IsInferencePreemptible = isInferencePreemptible
402-
}
403-
404395
func (ssn *Session) UseSchedulingSignatures() bool {
405396
return ssn.SchedulerParams.UseSchedulingSignatures
406397
}

pkg/scheduler/plugins/proportion/capacity_policy/capacity_policy.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ import (
1616
type capacityCheckFn func(requestedShare rs.ResourceQuantities, job *podgroup_info.PodGroupInfo) *api.SchedulableResult
1717

1818
type CapacityPolicy struct {
19-
queues map[common_info.QueueID]*rs.QueueAttributes
20-
isInferencePreemptible bool
19+
queues map[common_info.QueueID]*rs.QueueAttributes
2120
}
2221

23-
func New(queues map[common_info.QueueID]*rs.QueueAttributes, isInferencePreemptible bool) *CapacityPolicy {
24-
return &CapacityPolicy{queues, isInferencePreemptible}
22+
func New(queues map[common_info.QueueID]*rs.QueueAttributes) *CapacityPolicy {
23+
return &CapacityPolicy{queues}
2524
}
2625

2726
func (cp *CapacityPolicy) IsJobOverQueueCapacity(job *podgroup_info.PodGroupInfo,

pkg/scheduler/plugins/proportion/capacity_policy/capacity_policy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ var _ = Describe("Capacity Policy Check", func() {
158158
testName := name
159159
testData := data
160160
It(testName, func() {
161-
capacityPolicy := New(testData.queues, true)
161+
capacityPolicy := New(testData.queues)
162162
tasksToAllocate := podgroup_info.GetTasksToAllocate(testData.job, dummyTasksLessThen,
163163
dummyTasksLessThen, true)
164164
result := capacityPolicy.IsJobOverQueueCapacity(testData.job, tasksToAllocate)
@@ -311,7 +311,7 @@ var _ = Describe("Capacity Policy Check", func() {
311311
testName := name
312312
testData := data
313313
It(testName, func() {
314-
capacityPolicy := New(testData.queues, true)
314+
capacityPolicy := New(testData.queues)
315315
tasksToAllocate := podgroup_info.GetTasksToAllocate(testData.job, dummyTasksLessThen,
316316
dummyTasksLessThen, true)
317317
result := capacityPolicy.IsJobOverQueueCapacity(testData.job, tasksToAllocate)
@@ -467,7 +467,7 @@ var _ = Describe("Capacity Policy Check", func() {
467467
testName := name
468468
testData := data
469469
It(testName, func() {
470-
capacityPolicy := New(testData.queues, true)
470+
capacityPolicy := New(testData.queues)
471471
tasksToAllocate := podgroup_info.GetTasksToAllocate(testData.job, dummyTasksLessThen,
472472
dummyTasksLessThen, true)
473473
result := capacityPolicy.IsNonPreemptibleJobOverQuota(testData.job, tasksToAllocate)
@@ -1056,7 +1056,7 @@ var _ = Describe("Capacity Policy Check", func() {
10561056
testName := name
10571057
testData := data
10581058
It(testName, func() {
1059-
capacityPolicy := New(testData.queues, true)
1059+
capacityPolicy := New(testData.queues)
10601060
result := capacityPolicy.IsTaskAllocationOnNodeOverCapacity(testData.job.GetAllPodsMap()["task-a"],
10611061
testData.job, testData.node)
10621062
Expect(result.IsSchedulable).To(Equal(testData.expectedResult))

0 commit comments

Comments
 (0)