Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

priority scheduling: add priority queue #6149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

whitewindmills
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:
part of #5961

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 23, 2025
@karmada-bot karmada-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 23, 2025
@whitewindmills
Copy link
Member Author

/cc @RainbowMango @seanlaii @LeonZh0u @wengyao04 @zclyne

@karmada-bot
Copy link
Collaborator

@whitewindmills: GitHub didn't allow me to request PR reviews from the following users: wengyao04, zclyne, LeonZh0u.

Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @RainbowMango @seanlaii @LeonZh0u @wengyao04 @zclyne

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@whitewindmills whitewindmills force-pushed the priority-scheduling-queue branch from 7ef5e18 to 3199c80 Compare February 23, 2025 15:37
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/assign

@whitewindmills Can you take care of the failing tests?

@whitewindmills
Copy link
Member Author

@RainbowMango

yeah, I'm working on it.

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from rainbowmango. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@whitewindmills whitewindmills force-pushed the priority-scheduling-queue branch 2 times, most recently from 4594093 to 140f5b5 Compare February 24, 2025 09:34
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 35.28139% with 299 lines in your changes missing coverage. Please review.

Project coverage is 47.98%. Comparing base (15800f2) to head (c04fcd6).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pkg/scheduler/internal/queue/scheduling_queue.go 0.00% 165 Missing ⚠️
pkg/scheduler/internal/queue/active_queue.go 40.84% 37 Missing and 5 partials ⚠️
pkg/scheduler/metrics/queue/metrics.go 22.58% 24 Missing ⚠️
pkg/scheduler/internal/heap/heap.go 82.88% 15 Missing and 4 partials ⚠️
...r/internal/queue/rate_limiting_scheduling_queue.go 0.00% 19 Missing ⚠️
pkg/scheduler/event_handler.go 61.29% 10 Missing and 2 partials ⚠️
pkg/scheduler/internal/queue/types.go 42.85% 8 Missing ⚠️
pkg/apis/work/v1alpha2/binding_types_helper.go 0.00% 5 Missing ⚠️
pkg/scheduler/scheduler.go 66.66% 4 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6149      +/-   ##
==========================================
- Coverage   48.10%   47.98%   -0.13%     
==========================================
  Files         668      674       +6     
  Lines       55316    55760     +444     
==========================================
+ Hits        26611    26757     +146     
- Misses      26970    27259     +289     
- Partials     1735     1744       +9     
Flag Coverage Δ
unittests 47.98% <35.28%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@whitewindmills whitewindmills force-pushed the priority-scheduling-queue branch from 140f5b5 to c04fcd6 Compare February 24, 2025 09:52
@whitewindmills
Copy link
Member Author

ready to review.

@RainbowMango
Copy link
Member

Shall we have a quick chat at today's community meeting?

@whitewindmills
Copy link
Member Author

@RainbowMango
I'm currently unavailable, but we can book a meeting privately.

Comment on lines +208 to +215
// ExplicitPriority returns the explicit priority declared
// by '.spec.SchedulePriority.Priority'.
func (s *ResourceBindingSpec) ExplicitPriority() int32 {
if s.SchedulePriority == nil {
return 0
}
return s.SchedulePriority.Priority
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ExplicitPriority returns the explicit priority declared
// by '.spec.SchedulePriority.Priority'.
func (s *ResourceBindingSpec) ExplicitPriority() int32 {
if s.SchedulePriority == nil {
return 0
}
return s.SchedulePriority.Priority
}
// SchedulePriorityValue returns the scheduling priority declared
// by '.spec.SchedulePriority.Priority'.
func (s *ResourceBindingSpec) SchedulePriorityValue() int32 {
if s.SchedulePriority == nil {
return 0
}
return s.SchedulePriority.Priority
}

Given that ResourceBinding may introduce another priority other than the schedule aspect, I'd like to give it a more straightforward name.

@@ -239,7 +238,7 @@ func NewScheduler(dynamicClient dynamic.Interface, karmadaClient karmadaclientse
for _, opt := range opts {
opt(&options)
}
queue := workqueue.NewTypedRateLimitingQueueWithConfig(ratelimiterflag.DefaultControllerRateLimiter[any](options.RateLimiterOptions), workqueue.TypedRateLimitingQueueConfig[any]{Name: "scheduler-queue"})
queue := internalqueue.NewSchedulingQueue(internalqueue.WithRateLimitingOptions(options.RateLimiterOptions))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the legacy queue if the feature gate is disabled?

if !features.FeatureGate.Enabled(features.PriorityBasedScheduling) {
return &rateLimitingSchedulingQueue{
delegate: workqueue.NewTypedRateLimitingQueueWithConfig(ratelimiterflag.DefaultControllerRateLimiter[*QueuedBindingInfo](options.rateLimitingOptions),
workqueue.TypedRateLimitingQueueConfig[*QueuedBindingInfo]{Name: "scheduler-queue"}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RainbowMango we use the legacy queue here if the feature gate is disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants