Skip to content

feat(uv): sample wheel build memory usage when resource_set is set#1140

Open
xangcastle wants to merge 7 commits into
mainfrom
xangcastle/uv-1-wheel-build-memory
Open

feat(uv): sample wheel build memory usage when resource_set is set#1140
xangcastle wants to merge 7 commits into
mainfrom
xangcastle/uv-1-wheel-build-memory

Conversation

@xangcastle

@xangcastle xangcastle commented Jun 23, 2026

Copy link
Copy Markdown
Member

Adds a memory-monitoring layer to sdist wheel builds. When a resource_set other than "default" is declared, the wheel build action now runs under a sampler that tracks aggregate resident-set size (RSS) of the build process and all its descendants, and reports the peak to stderr.

This gives users concrete data to calibrate their resource_set estimates. Rather than guessing whether "mem_2g" is enough, they can observe what the build actually consumes.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes

Test plan

  • New test cases added

@aspect-workflows

aspect-workflows Bot commented Jun 23, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Tue Jun 23 05:31:20 UTC 2026

✅ 7 successful tasks

  • ✅ buildifier · ⏱ 32.8s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ gazelle · ⏱ 19.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ test (test-e2e-bazel-8) · ⏱ 2m 17s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (153/153 passed)
  • ✅ test (test-e2e-bazel-9) · ⏱ 2m 36s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (148/148 passed)
  • ✅ test (test-examples-uv_pip_compile-bazel-8) · ⏱ 23.4s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)
  • ✅ test (test-root-bazel-8) · ⏱ 1m 58s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (200/200 passed)
  • ✅ test (test-root-bazel-9) · ⏱ 1m 50s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (199/199 passed)

⏱ Last updated Tue Jun 23 05:34:09 UTC 2026 · 📊 GitHub API quota 105/15,000 (1% used, resets in 30m)
🚀 Powered by Aspect CLI (v2026.24.11)  |  Aspect Build · X · LinkedIn · YouTube

@xangcastle xangcastle force-pushed the xangcastle/uv-1-wheel-build-memory branch from cbbab78 to f1048c6 Compare June 23, 2026 04:46
@xangcastle xangcastle changed the title xangcastle/uv-1-wheel-build-memory feat: Memory monitoring for wheel builds Jun 23, 2026
…ry' into xangcastle/uv-1-wheel-build-memory

# Conflicts:
#	docs/uv-patching.md
#	e2e/BUILD.bazel
#	e2e/cases/uv-sdist-jdk-build/setup.MODULE.bazel
#	uv/private/extension/defs.bzl
#	uv/private/pep517_whl/BUILD.bazel
#	uv/private/pep517_whl/rule.bzl
#	uv/private/sdist_build/repository.bzl
@xangcastle xangcastle changed the title feat: Memory monitoring for wheel builds feat(uv): Memory monitoring for wheel builds Jun 23, 2026
@xangcastle xangcastle changed the title feat(uv): Memory monitoring for wheel builds feat(uv): sample wheel build memory usage when resource_set is set Jun 23, 2026
@xangcastle xangcastle requested a review from jbedard June 23, 2026 05:34
@xangcastle xangcastle marked this pull request as ready for review June 23, 2026 05:34
tamird referenced this pull request Jun 23, 2026
Let each sdist override declare a local execution memory estimate. Bazel
can then limit concurrent wheel builds without reserving the same amount
for every package.

When an estimate is present, sample aggregate RSS for the build process
tree and print the peak on exit. The action log supplies evidence for
adjusting that package's estimate after a successful build or OOM.

tamird commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

The resource_set reservation is the right scheduler API and is already
on main. The monitor is still useful for post-OOM tuning, but its trigger
and process ownership should be narrower:

  • resource_set should not implicitly enable monitoring. Reservation and
    diagnostics are independent; use an explicit monitor_memory opt-in.
  • Do not use start_new_session or kill the backend process group. Bazel owns
    the action process group and its cancellation semantics. Launch the backend
    normally and sample its descendants on a best-effort basis.

The output should remain explicitly approximate Linux procfs RSS, not a hard
limit or a remote-executor sizing mechanism.

@tamird

tamird commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Superseded by #1174. The replacement is rebuilt on current main, makes
monitoring an explicit opt-in independent from resource_set, and leaves
process-group cancellation to Bazel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants