Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: prioritise human-initiated builds over prebuilds#18933

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

Merged

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedJul 21, 2025
edited
Loading

Continues from#18882

  • Reverts extraneous changes
  • Adds explicitORDER BY initiator_id = $PREBUILDS_USER_ID toAcquireProvisionerJob
  • Improves test added for above PR

bpmct and dannykopping reacted with hooray emoji
blink-sobotand others added5 commitsJuly 21, 2025 12:31
…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>
AND provisioner_tagset_contains(@provisioner_tags :: jsonb,potential_job.tags :: jsonb)
ORDER BY
-- Ensure that human-initiated jobs are prioritized over prebuilds.
potential_job.initiator_id='c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice idea, I like the simplicity of prioritizing human-initiated jobs.
That said, I’m a bit concerned about the risk ofprebuild starvation under heavy load. If I understand the query correctly, we’re first ordering by whether the job is human-initiated (higher priority), and then bycreated_at within each group. That meansprebuild jobs will only be picked up once all human-initiated jobs have been processed.

Would it make sense to consider an ordering strategy that also takes into account how long a job has been waiting in the queue? I know we don’t have an explicitenqueued_at field, but maybecreated_at could serve that purpose. That way, we could still prioritize human jobs, but allow older prebuilds to eventually be picked up and get processed, avoiding starvation while maintaining the intended prioritization.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That means prebuild jobs will only be picked up once all human-initiated jobs have been processed.

Correct. The assumption here is that there will never be a constant stream of human-initiated jobs. If this is the case, then the deployment is undersized and requires more provisioners.

Would it make sense to consider an ordering strategy that also takes into account how long a job has been waiting in the queue?

I'm not sure the added complexity is worthwhile here. How likely is it for users to be creating a constant stream of provisioner jobs similar in volume to that of the prebuilds reconciler?

Also, we need to decide how long is 'too long' for a prebuild to wait? 1 minute? 10 minutes? Does it need to be configurable?

Finally, after the initial waiting period elapses, users will still end up in the situation where they will be stuck waiting on a bunch of provisioner jobs (as the prebuilds reconciler creates provisioner jobs in batches).

My take is thatif you are running into this problem in the first place, you need more provisioners.

I do like the suggestion of leveragingcoder_workspace_tags to conditionally send prebuilds to a separate set of provisioners, but it appears thattfparse is not able to evaluate that right now.

SasSwart reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

I had the same starvation concern in the original PR, but your point convinced me@johnstcn.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to update that query that tells us the queue position too?

Copy link
MemberAuthor

@johnstcnjohnstcnJul 21, 2025
edited
Loading

Choose a reason for hiding this comment

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

oof maybe yea Done

coderabbitai[bot]

This comment was marked as resolved.

@codercoder deleted a comment fromcoderabbitaibotJul 21, 2025
@johnstcnjohnstcn merged commitc4b69bb intomainJul 22, 2025
30 checks passed
@johnstcnjohnstcn deleted the cj/fix-database-AcquireProvisionerJob-prebuild-priority branchJuly 22, 2025 12:03
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 22, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@ssncferreirassncferreirassncferreira left review comments

@EmyrkEmyrkEmyrk approved these changes

@SasSwartSasSwartSasSwart approved these changes

+1 more reviewer

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

Reviewers whose approvals may not affect merge requirements
Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@johnstcn@ssncferreira@Emyrk@SasSwart

[8]ページ先頭

©2009-2025 Movatter.jp