-
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(block-scheduler): job tracking & offset commits #15338
Conversation
logger := log.With(s.logger, "job", job.ID()) | ||
|
||
if success { | ||
// TODO(owen-d): do i need to increment offset here? |
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.
i think we need to commit job.Offsets().Max-1
given builders only consume upto but not including Max
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.
sounds good
if err = s.offsetManager.Commit( | ||
ctx, | ||
job.Partition(), | ||
job.Offsets().Max, |
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.
next jobs would start with job.Offsets().Max
job.Offsets().Max, | |
job.Offsets().Max-1, |
s.queue.pending.Push( | ||
NewJobWithMetadata( | ||
job, | ||
DefaultPriority, |
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.
shouldn't failed jobs instead get a higher priority?
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.
Yes, but I didn't want to complicate the PR further by adding logic for priority discovery on retries. I think this is best left for a followup PR.
type priorityHeap[V any] struct { | ||
less func(V, V) bool | ||
heap []*item[V] | ||
idx map[int]*item[V] // Maps index to item for efficient updates |
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.
do we use this for lookups? i don't see any references
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.
good call 👍
|
||
// Add new item | ||
idx := pq.h.Len() | ||
it := &item[V]{value: v, index: idx} |
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.
there is a bit of duplication, we update the index
of the item here and within the heap's Push() method.
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
Block Builder Scheduler Updates
Key improvements to the scheduler component focused on jobs and state management:
Job Handling
Queue Improvements
Other Changes
No migration needed - internal changes only. Next up: metrics, docs, and retry policies.