-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat(blockbuilder): priority queue for job dispatching #15245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
q.mu.Lock() | ||
defer q.mu.Unlock() | ||
|
||
assignment, exists := q.inProgress[jobID] | ||
// Find job in in-progress map | ||
inProgressJob, exists := q.inProgress[jobID] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe this should not error? if a scheduler restarted and lost it's state we'd miss committing already consumed jobs.
but this can be worried about later when we add the committer logic
pkg/blockbuilder/scheduler/queue.go
Outdated
if !exists { | ||
return fmt.Errorf("job %s not found in progress", jobID) | ||
// Check if job already exists | ||
if status, exists := q.statusMap[jobID]; exists { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not error?
Block Builder Scheduler Refactoring: Priority-Based Job Queue
Overview
This PR refactors the block builder scheduler to introduce a more sophisticated job prioritization system. The changes improve job scheduling efficiency and provide better control over job execution order.
Key Changes
1. Generic Priority Queue Implementation
JobWithPriority[T comparable]
type to support flexible priority mechanisms2. Circular Buffer for Completed Jobs
3. Job Queue Enhancements
4. Planner Interface Updates
[]*JobWithPriority[int]