Repository navigation
Conversation
|
I think this deserves a What happens if one mentions "invalid" resources in |
done |
Previously only tests supported a target level way to hint the resources
required by the target. This is done with `tags = ["resources:cpu:10"]`.
Now this syntax is supported for normal actions as well, and both normal
actions and test actions support this same format in `exec_properties`
with `exec_properties = {"resources:cpu": "10"}`, or exec_group specific
versions like: `exec_properties = {"cpp_link.resources:cpu": "10"}`.
Work towards bazelbuild#19679 (doesn't
handle a default flag currently)
Fixes bazelbuild#19805
Fixes bazelbuild#25195
Fixes bazelbuild#25792
Fixes bazelbuild#25793
0ea3ea9 to
b0e5e53
Compare
In the case you have an invalid value like (just updated because of this comment to not throw a nasty exception but instead fail nicely like it does with tests today) If you have an empty cpu value like If you have a custom resource like: exec_properties = {"resources:gpu": "3"},which isn't known, you get this error: This goes away if you actually use it with Do these examples cover the cases you were thinking about?
improved to be like it is today @ HEAD with tests vs an exception |
|
@bazel-io flag |
|
@bazel-io fork 9.2.0 |
|
thanks! (definitely just 9.x for this one) |
…lbuild#29426) Previously only tests supported a target level way to hint the resources required by the target. This is done with `tags = ["resources:cpu:10"]`. Now this syntax is supported for normal actions as well, and both normal actions and test actions support this same format in `exec_properties` with `exec_properties = {"resources:cpu": "10"}`, or exec_group specific versions like: `exec_properties = {"cpp_link.resources:cpu": "10"}`. Work towards bazelbuild#19679 (doesn't handle a default flag currently) Work towards bazelbuild#17368 Work towards bazelbuild#25770 Fixes bazelbuild#6477 Fixes bazelbuild#19805 Fixes bazelbuild#25195 Fixes bazelbuild#25792 Fixes bazelbuild#25793 RELNOTES[inc]: `exec_properties` now respects `resources:cpu` and `resources:memory` for local resource estimation. Closes bazelbuild#29284. Closes bazelbuild#29419 PiperOrigin-RevId: 906919034 Change-Id: Ia9effd70a71f4e1f42021d945cdc7b1d9d52bbf6 (cherry picked from commit d35da0e)
## Summary - Document bazelbuild/bazel#29284 as the proper fix for local resource scheduling on Bazel 9.2.0+ - Note that `exec_properties` with `resources:cpu` and `resources:memory` is preferred over the `resource_set` workaround when available ## Test plan - [x] Docs-only change; no code behavior changes
### Description Fixes a regression introduced by #29284 where local resource specifications (`resources:*:*`, `cpu:*` and `memory:*`) affected builtin actions such as; - `test.xml` generator action - C spawn include scanner Also moves resource overriding into `ResourceSetOrBuilder` to reduce the risk of drift between `BaseSpawn` and `SimpleSpawn`. ### Motivation Deriving local resource sets in these builtin spawns causes otherwise lightweight tasks to backup (and temporarily block) other larger spawns due to them taking an unreasonably high number of resource permits. In the case of `test.xml` generation, when resources are exhausted it can cause tests to visibly appear as if they are running for much longer than they really are (exacerbation of an existing issue where `test.xml` generation scheduling is not differentiated from spawn running in UI and potentially elsewhere). ### Build API Changes No ### Checklist - [x] I have added tests for the new use cases (if any). - [x] I have updated the documentation (if applicable). ### Release Notes RELNOTES: Fix for regression in #29284 that caused select builtin actions to incorrectly inherit resource set overrides. Closes #30747. PiperOrigin-RevId: 981231820 Change-Id: If2dd7b33fefca8ebe2ba4866cc87bc7316230fd1
…build#29284 (https… (bazelbuild#31136) …://github.com/bazelbuild/pull/30747) Fixes a regression introduced by bazelbuild#29284 where local resource specifications (`resources:*:*`, `cpu:*` and `memory:*`) affected builtin actions such as; - `test.xml` generator action - C spawn include scanner Also moves resource overriding into `ResourceSetOrBuilder` to reduce the risk of drift between `BaseSpawn` and `SimpleSpawn`. Deriving local resource sets in these builtin spawns causes otherwise lightweight tasks to backup (and temporarily block) other larger spawns due to them taking an unreasonably high number of resource permits. In the case of `test.xml` generation, when resources are exhausted it can cause tests to visibly appear as if they are running for much longer than they really are (exacerbation of an existing issue where `test.xml` generation scheduling is not differentiated from spawn running in UI and potentially elsewhere). No - [x] I have added tests for the new use cases (if any). - [x] I have updated the documentation (if applicable). RELNOTES: Fix for regression in bazelbuild#29284 that caused select builtin actions to incorrectly inherit resource set overrides. Closes bazelbuild#30747. PiperOrigin-RevId: 981231820 Change-Id: If2dd7b33fefca8ebe2ba4866cc87bc7316230fd1 <!-- Thank you for contributing to Bazel! Please read the contribution guidelines: https://bazel.build/contribute --> ### Description <!-- Please provide a brief summary of the changes in this PR. --> ### Motivation <!-- Why is this change important? Does it fix a specific bug or add a new feature? If this PR fixes an existing issue, please link it here (e.g. "Fixes bazelbuild#1234"). --> ### Build API Changes <!-- Does this PR affect the Build API? (e.g. Starlark API, providers, command-line flags, native rules) If yes, please answer the following: 1. Has this been discussed in a design doc or issue? (Please link it) 2. Is the change backward compatible? 3. If it's a breaking change, what is the migration plan? --> No ### Checklist - [ ] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes <!-- If this is a new feature, please add 'RELNOTES[NEW]: <description>' here. If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here. If this change should be mentioned in release notes, please add 'RELNOTES: <reason>' here. --> RELNOTES: None Commit bazelbuild@af88dde Co-authored-by: Jordan Mele <[email protected]>
Baseline: 6332cd9 Cherry picks: + 1f39b46: Avoid storing missing mandatory attribute state as a field on Rule. New features: - `DefaultInfo.executable` exposes the executable of configured targets and directly constructed providers, including providers returned by `ctx.super()`. Important changes: - Skip implicit output generation when mandatory rule attributes are missing to prevent secondary error messages. - Fix crash when evaluating target patterns or paths containing invalid characters or wildcards on Windows. - Facts of reproducible module extensions are now restored to the expected state after external modifications by every Bazel command that updates the lockfile. - Fix for regression in #29284 that caused select builtin actions to incorrectly inherit resource set overrides. - `bazel fetch --force` no longer causes the fetched repos to be fetched again by the next build with a spurious warning about external modifications. This release contains contributions from many people at Google, as well as Benjamin Peterson, Daniel Burrell, David Zbarsky, Fabian Meumertzheim, Fabian Meumertzheim, Henner Zeller, jdymitarai, Jordan Mele, Keith Smiley, Raiyyan Ur Rahman Mohammed, Son Luong Ngoc.
### What does this PR do? Book 6144 MiB for the `GoLink` action of the 9 non-`manual` `dd_agent_go_test` unit test targets whose packages import the e2e framework, through the `go_link` exec group's `resources:memory`. 6144 is the multiple of 1024 closest to their peak link RSS, measured between 5826 MiB (lower bound) and 6241 MiB (upper bound) on Linux. Document the pattern in `bazel/AGENTS.md`. ### Motivation `bazel:test:windows-amd64:go` failed in the merge queue (https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2121988398) with 5 unit test binaries failing to link and `client_test` timing out after 304s instead of passing in seconds: ``` runtime: VirtualAlloc of 1540096 bytes failed with errno=1455 fatal error: out of memory ``` Since #57555, `rules_go` is patched for `GoLink` to declare a flat 2048 MiB `resource_set`, which stopped the `go_e2e_test_binaries` OOM kills on `main` but can't account for outliers. Linking these unit tests peaks at about 30 times the on-disk footprint of their binaries, which embed the e2e framework and weigh 195MiB to 227MiB. On 32GiB `c5.4xlarge` runners, Bazel thus runs enough of these links at once to exhaust the commit limit. ### Describe how you validated your changes `bazel aquery` shows `resources:memory=6144` on the `GoLink` actions of the 9 targets only, not on their compile or test actions. With `--local_resources=memory=13000`, a Bazel profile of their 9 links shows at most 2 running concurrently instead of 6. ### Additional Notes Bazel honors `resources:*` exec properties in local scheduling since 9.2.0 (bazelbuild/bazel#29284), overriding the action's `resource_set`.
…57863) ### What does this PR do? Tell Bazel to account for 6144 MiB (RSS) for the `GoLink` action of the 9 `dd_agent_go_test` unit test targets whose packages import the e2e framework, through a `go_link:enormous` tag that the macro translates into the `go_link` exec group's `resources:memory`. 6144 is the multiple of 1024 closest to their peak link RSS, measured between 5826 MiB (lower bound) and 6241 MiB (upper bound) on Linux. Document the pattern in `bazel/AGENTS.md`. ### Motivation `bazel:test:windows-amd64:go` [failed in the merge queue](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/2121988398) with 5 unit test binaries failing to link and `client_test` timing out after 304s instead of passing in seconds: ``` runtime: VirtualAlloc of 1540096 bytes failed with errno=1455 fatal error: out of memory ``` ... and this was [not an isolated case](https://app.datadoghq.com/logs?query=service%3Agitlab-ci%20%40ci.pipeline.name%3A%22DataDog%2Fdatadog-agent%22%20%22VirtualAlloc%22&agg_m=count&agg_m_source=base&agg_t=count&clustering_pattern_field_path=message&cols=host%2Cservice%2Cci.node.name&index=ci-app-pipeline-logs-gitlab-datadog-agent&messageDisplay=inline&refresh_mode=sliding&storage=hot&stream_sort=time%2Cdesc&viz=stream&from_ts=1790877978397&to_ts=1791482778397). Since #57555, `rules_go` is patched for `GoLink` to declare a flat 2048 MiB `resource_set` (in lieu of only 250), which stopped the `go_e2e_test_binaries` OOM kills on `main` but can't account for outliers. Linking these unit tests indeed peaks at about 30 times the on-disk footprint of their binaries, which embed the e2e framework and weigh 195MiB to 227MiB. On the 32GiB `c5.4xlarge` runners used by Windows jobs, for instance, Bazel thus runs enough of these links at once to exhaust the commit limit. ### Describe how you validated your changes `bazel aquery` shows `resources:memory=6144` on the `GoLink` actions of the 9 targets only, not on their compile or test actions. With `--local_resources=memory=13000`, a Bazel profile of their 9 links shows at most 2 running concurrently instead of 6. ### Additional Notes Bazel honors `resources:*` exec properties in local scheduling since 9.2.0 (bazelbuild/bazel#29284), overriding the action's `resource_set`. Co-authored-by: regis.desgroppes <[email protected]>
Previously only tests supported a target level way to hint the resources
required by the target. This is done with
tags = ["resources:cpu:10"].Now this syntax is supported for normal actions as well, and both normal
actions and test actions support this same format in
exec_propertieswith
exec_properties = {"resources:cpu": "10"}, or exec_group specificversions like:
exec_properties = {"cpp_link.resources:cpu": "10"}.Work towards #19679 (doesn't
handle a default flag currently)
Work towards #17368
Work towards #25770
Fixes #6477
Fixes #19805
Fixes #25195
Fixes #25792
Fixes #25793
RELNOTES[inc]:
exec_propertiesnow respectsresources:cpuandresources:memoryfor local resource estimation.