Skip to content

Commit

Permalink
cli: Make the CLI cgroups-aware
Browse files Browse the repository at this point in the history
Honoring cgroups limits on CPUs is useful when running `bb explain` in a workflow, such as in the "Compare" Bazel button.
  • Loading branch information
fmeum committed Jan 23, 2025
1 parent 6a694db commit 38bc1b4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ use_repo(
"org_golang_x_time",
"org_golang_x_tools",
"org_uber_go_atomic",
"org_uber_go_automaxprocs",
)

# Note that this is 'rules_nodejs-core'
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/bb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(
"//cli/watcher",
"//server/util/rlimit",
"//server/util/status",
"@org_uber_go_automaxprocs//:automaxprocs",
],
)

Expand Down
3 changes: 3 additions & 0 deletions cli/cmd/bb/bb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import (
"github.com/buildbuddy-io/buildbuddy/server/util/status"

sidecarmain "github.com/buildbuddy-io/buildbuddy/cli/cmd/sidecar"

// Make GOMAXPROCS cgroups-aware.
_ "go.uber.org/automaxprocs"
)

var (
Expand Down
12 changes: 12 additions & 0 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,12 @@ def install_go_mod_dependencies(workspace_name = "buildbuddy"):
sum = "h1:xoIK0ctDddBMnc74udxJYBqlo9Ylnsp1waqjLsnef20=",
version = "v0.0.0-20190930134022-aa0246cd15f7",
)
go_repository(
name = "com_github_prashantv_gostub",
importpath = "github.com/prashantv/gostub",
sum = "h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=",
version = "v1.1.0",
)
go_repository(
name = "com_github_prometheus_client_golang",
build_directives = [
Expand Down Expand Up @@ -6353,6 +6359,12 @@ def install_go_mod_dependencies(workspace_name = "buildbuddy"):
sum = "h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=",
version = "v1.11.0",
)
go_repository(
name = "org_uber_go_automaxprocs",
importpath = "go.uber.org/automaxprocs",
sum = "h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=",
version = "v1.6.0",
)
go_repository(
name = "org_uber_go_goleak",
importpath = "go.uber.org/goleak",
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ require (
go.opentelemetry.io/otel/sdk v1.29.0
go.opentelemetry.io/otel/trace v1.31.0
go.uber.org/atomic v1.11.0
go.uber.org/automaxprocs v1.6.0
golang.org/x/crypto v0.31.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/mod v0.20.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,8 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:Om
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
Expand Down Expand Up @@ -1738,6 +1740,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
Expand Down

0 comments on commit 38bc1b4

Please sign in to comment.