- Notifications
You must be signed in to change notification settings - Fork1k
feat: prioritize human-initiated workspace builds over prebuilds in queue#18882
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ueueThis change implements a priority queue system for provisioner jobs to ensurethat human-initiated workspace builds are processed before prebuild jobs,improving user experience during high queue periods.Changes:- Add priority column to provisioner_jobs table (1=human, 0=prebuild)- Update AcquireProvisionerJob query to order by priority DESC, created_at ASC- Set priority in workspace builder based on initiator (PrebuildsSystemUserID)- Expose priority field in API and SDK- Add comprehensive test for priority queue behaviorCo-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
johnstcn left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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'd rather not add a new column here, as this requires a migration and migrations are difficult to backport, and this seems like something we would want to backport. We could instead add an explicitCASE WHEN
oninitiator_id
to perform the ordering.
EDIT: can you please also link an associated GH issue, if it exists?
Continues from#18882- Reverts extraneous changes- Adds explicit `ORDER BY initiator_id = $PREBUILDS_USER_ID` to`AcquireProvisionerJob`- Improves test added for above PR---------Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
I guess we can close it now. |
Address review feedback by removing the priority column migrationand instead using a CASE WHEN statement in the AcquireProvisionerJobquery to prioritize human-initiated jobs over prebuilds.This approach avoids the need for a migration while maintainingthe same functionality.Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Summary
Implements a priority queue system for provisioner jobs to ensure human-initiated workspace builds are processed before prebuild jobs, improving user experience during high queue periods.
Changes
AcquireProvisionerJob
query to useCASE WHEN
oninitiator_id
to order by priorityHow it works
AcquireProvisionerJob
query now uses aCASE WHEN
statement to prioritize jobs:initiator_id != PrebuildsSystemUserID
get priority 1 (human-initiated)initiator_id = PrebuildsSystemUserID
get priority 0 (prebuilds)Testing
Impact
Related to provisioner queue issues like#15843 and#16488 - this addresses the specific case where prebuilds can delay human-initiated workspace builds during busy periods.