Introduce --local_resources flag#20398
Introduce --local_resources flag#20398AlessandroPatti wants to merge 7 commits intobazelbuild:masterfrom
Conversation
|
cc @zhengwei143 |
| @@ -294,6 +294,8 @@ public boolean shouldMaterializeParamFiles() { | |||
| @Option( | |||
| name = "local_cpu_resources", | |||
| defaultValue = "HOST_CPUS", | |||
There was a problem hiding this comment.
Is there a way to keep using these variables in --local_resources? That would be worth documenting in the flag's description.
Also, what is going to happen to the default values for cpu and memory?
There was a problem hiding this comment.
Is there a way to keep using these variables in --local_resources? That would be worth documenting in the flag's description.
Aah, good point. I've refactored a bit the converter to support both integers and doubles and added support for HOST_CPUS and HOST_RAM
Also, what is going to happen to the default values for cpu and memory?
Once --local_{cpu,ram}_resources are deprecated and removed, they should probably be moved here. I've added a comment as a reminder.
a9d099b to
74225e4
Compare
74225e4 to
620a249
Compare
| */ | ||
| public class ResourceConverter extends Converters.IntegerConverter { | ||
| public abstract class ResourceConverter<T extends Number & Comparable<T>> extends Converter.Contextless<T> { | ||
| public static final Supplier<Integer> HOST_CPUS = |
There was a problem hiding this comment.
Nit: Rename to HOST_CPUS_SUPPLIER. Similarly to HOST_RAM_SUPPLIER below.
| private static final ResourceConverter.DoubleConverter resource = | ||
| new ResourceConverter.DoubleConverter( | ||
| ImmutableMap.of( | ||
| "HOST_CPU", () -> (double) HOST_CPUS.get(), |
There was a problem hiding this comment.
Nit: Refactor "HOST_CPU" and "HOST_RAM" into a static String variables.
| () -> (int) Math.ceil(LocalHostCapacity.getLocalHostCapacity().getMemoryMb())), | ||
| /* minValue= */ 0, | ||
| /* maxValue= */ Integer.MAX_VALUE); | ||
| super(ImmutableMap.of("HOST_RAM", HOST_RAM), 0, Integer.MAX_VALUE); |
There was a problem hiding this comment.
Nit: Add /* minValue= */ comments for argument 0 since it isn't immediately obvious. Same as for all other similar changes.
|
@zhengwei143 @keertk any blocker for this to land? |
|
Hi, drive-by comment, I've been on vacation and will be till the start of next year - so will push this through when I'm back then. |
|
@AlessandroPatti Sorry this took so long due to the holidays, thanks for your contribution! |
|
@bazel-io fork 7.1.0 |
Follow up for bazelbuild#19839 (comment), introduce new flag that will replace all the others. Closes bazelbuild#20398. PiperOrigin-RevId: 596905096 Change-Id: Ic2c20dae40efa797953cde6934085f899acb9b52
Follow up for #19839 (comment), introduce new flag that will replace all the others. Closes #20398. Commit ea75928 PiperOrigin-RevId: 596905096 Change-Id: Ic2c20dae40efa797953cde6934085f899acb9b52 Co-authored-by: Alessandro Patti <[email protected]>
Follow up for bazelbuild#19839 (comment), introduce new flag that will replace all the others. Closes bazelbuild#20398. PiperOrigin-RevId: 596905096 Change-Id: Ic2c20dae40efa797953cde6934085f899acb9b52
Follow up for bazelbuild#19839 (comment), introduce new flag that will replace all the others. Closes bazelbuild#20398. PiperOrigin-RevId: 596905096 Change-Id: Ic2c20dae40efa797953cde6934085f899acb9b52
|
The changes in this PR have been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
Follow up for #19839 (comment), introduce new flag that will replace all the others.