-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement separate long build queues #13
Conversation
|
src/queue_types.rb
Outdated
MACOS_X86_64_LEGACY_LONG = 3 | ||
MACOS_ARM64_LONG = 4 | ||
MACOS_X86_64_LONG = 5 |
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's probably a more elegant way of encoding the fact that we want a long variant of an existing queue type...
This is good and is also how I would have done it. One problem here though is we now have 12 slots for short queue and a separate 12 slots for the long queue. We don't have 24 slots, so what we actually want is 12 slots shared between the two of them and somehow make it dynamic so that long builds get limited to 6 or so but short builds can extend up to the full 12 if free. My initial thought a while back was a priority queue but that probably doesn't work well if we want to limit long builds to a different quantity. |
Yes, this was my thinking too. Just not quite sure how to make it work without invasive changes to existing code. Will give it more of a think. |
One approach could be to replace the start processors' That may not necessarily be the best structure. concurrent-ruby may or may not have some inspiration ( In the end, every queue will have short and long items so some sort of in-queue handling would make sense here. Ideally we would generalise it well, so that say a |
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.
Makes sense to me so far! Good to merge when @Bo98 is happy.
2c9c147
to
ea7b4f7
Compare
This needs a bit of cleaning up, but I think it's in a state where we're able to discuss the approach. |
46bd7a4
to
8de88c3
Compare
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.
Looks good! Only comments I would have are those already present. Thanks @carlocab!
src/job_queue.rb
Outdated
@mutex.synchronize do | ||
running_long_build_count = @state.running_jobs(@queue_type).count(&:long_build?) | ||
|
||
if (running_long_build_count < 2 || @queue[:default].empty?) && !@queue[:long].empty? |
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 check may not necessarily be what we want (because it allows us to queue many long build jobs if the default queue is empty), but I haven't worked out how to avoid the situation where we try to call @queue[:default].pop
on an empty @queue[:default]
.
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.
Yeah this is an issue particularly since the mutex will not be released when waiting on pop
.
A couple solutions may be one or both of:
- Blocking a condition variable when both are empty that is reset on
<<
. - Not using
Queue
at all and instead use an array (given we won't be using the blocking feature anymore).
bda2ca8
to
dd244b7
Compare
This is needed after Homebrew/ci-orchestrator#13.
This implements a separate queue for long-running builds that are identified by a tag `-long` in the runner name.
f0fe505
to
513797a
Compare
Looks good, thanks! Only issue I found was Will deploy shortly. |
This shouldn't be needed anymore after Homebrew/ci-orchestrator#13.
loop do | ||
running_long_build_count = SharedState.instance.running_jobs(@queue_type).count(&:long_build?) | ||
|
||
if running_long_build_count < 2 && !@queue[:long].empty? |
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.
Given the limit in homebrew-core is 2 PRs, with a PR containing 3 OS versions, don't we actually want this to be 6 instead?
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.
Maybe? Is that the count we want per queue_type
? If so, then yes, I think that's correct.
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.
So these are our queue types:
ci-orchestrator/src/queue_types.rb
Lines 7 to 9 in 8b19a5f
MACOS_X86_64_LEGACY = 0 | |
MACOS_ARM64 = 1 | |
MACOS_X86_64 = 2 |
So, yes, 6
seems correct. Will open a new PR.
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 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.
Yeah. All arm64 is all one queue type so 6 sounds correct to me.
x86_64 is technically two types but that's not going to be the case come macOS 15.
This implements a separate queue for long-running builds that are
identified by a suffix
-long
in the runner name.The values for
slots
insrc/queue_types.rb
is probably wrong, andwill need adjusting.
This should achieve having an entirely separate queue for long build
jobs. What isn't clear to me is whether this leads to unused capacity
when there are no long build jobs to be done but there are queued short
build jobs waiting.