Add a configuration item to limit parallelism#2049
Conversation
|
Can we have tests? It would be great if we can also have this as a |
|
I thought something per-build as well but maybe it is better to leave that to a better solution that can monitor resource usage. I guess for the test we could do 2 parallel sleep runs that print a start/end date and check that they are sequential if this config is set to 1. Maybe there is something better. |
|
Sounds good. Got swamped with a few other things. Will take a look next week. |
|
I've added a draft test to this (WIP). I can't figure out how to set the buildkit configuration as part of an integration test. Do you have any pointers to some test code doing something like that? |
|
@vladaionescu Look at how the secmode/netmode is implemented https://github.com/moby/buildkit/blob/master/client/client_test.go#L3485-L3495 |
456f4c4 to
cb912d4
Compare
|
Ok test is done - thanks for bearing with me. Ready for another look! |
solver/jobs.go
Outdated
| DefaultCache CacheManager | ||
| ResolveOpFunc ResolveOpFunc | ||
| DefaultCache CacheManager | ||
| ParallelismSem *semaphore.Weighted |
There was a problem hiding this comment.
Bit weird to pass the semaphore object as a opt in here rather than the number. Any reason for it?
There was a problem hiding this comment.
Main reason was to keep the interpretation of the number 0 in the same place where the config is interpreted. Not a strong opinion though.
a704f2a to
fd0eda0
Compare
Signed-off-by: Vlad A. Ionescu <[email protected]>
66e8125 to
489e17a
Compare
|
This is now ready for another look.
I ended up using a |
Signed-off-by: Vlad A. Ionescu <[email protected]>
Sounds good - I've switched over to the new It's possible to move the |
Didn't think of this but might even make sense to put it under worker. Eg. if you have multiple workers and one is a very big machine and another one is small. You may want to have different configs for them. |
tonistiigi
left a comment
There was a problem hiding this comment.
Where is the new test running in CI? I think we might be skipping it
Signed-off-by: Vlad A. Ionescu <[email protected]>
|
Ok ready for another look.
Done.
I just added the |
A value of
0disables the feature (default).CC @tonistiigi
Signed-off-by: Vlad A. Ionescu [email protected]