buildbuddy-io / buildbuddy

BuildBuddy is an open source Bazel build event viewer, result store, remote cache, and remote build execution platform.

Home Page:https://buildbuddy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature-request] fine-grained `exclusive`

qzmfranklin opened this issue · comments

I'm running a few tests with exclusive. With remote execution at buildbuddy, I'd like to have a way (e.g., exec_properties) to express the constraint that these tests are mutually exclusive but are not mutually exclusive with other tests or build.

So that these mutually exclusive tests can still run in parallel if there is enough remote executors.

Otherwise, these tests are forced to run locally and in serial, greatly slowing down everything.

BuildBuddy currently only implements the server-side of Remote Execution API v2 https://github.com/bazelbuild/remote-apis/blob/main/build/bazel/remote/execution/v2/

The "scheduling" of actions, under the current API design, is still with the client side.
Today, Bazel implements the client side of the API and is in charge of telling BuildBuddy when to start executing an action.
That means the change you are looking for must happen on Bazel side before we could do anything on BuildBuddy side.

You could be interested in bazelbuild/bazel#6477 and the related commit bazelbuild/bazel@d7f0724

On the remote side, this should theoretically be possible with a platform property - thanks for the feature request!

Hi, thanks for the prompt and positive feedback. @sluongng @siggisim

Also thanks for reaching out via DM in slack. @sluongng

The question I was asked by @sluongng in slack was this: what use case for it do you have in mind?

TLDR: I don't think my specific use case justifies a feature request of expressing mutual exclusivity via exec_properties or the like. But I do think there is general need for this.

The exact use case I had was like:

I am using rules_python's multi-version setup (https://github.com/bazelbuild/rules_python/tree/main/examples/multi_python_versions).

I build a C/C++-linked pip wheel with its py_wheel rule, published to test.pypi here (https://test.pypi.org/project/zhongming-pybind-multiversion-example/#files).

Then, I used different versions of Python vendored by rules_python (like this one https://github.com/bazelbuild/rules_python/blob/c72c7bcf4e0899c275042328e8233e3124ccae86/examples/multi_python_versions/tests/BUILD.bazel#L2), to run python3 -m pip install on my own wheels to see if they properly install and load.

Apparently, python3 -m pip install requires access to the current user's ~/.cache/pypi directory and modifies the site-packages directory inside it.

As such, running these python3 -m pip install tests are common dependent on a shared filesystem. So these tests must be mutually exclusive.

Per my understanding, there is probably ways to make pip use different directories than the default ~/.cache/pypi. So I did not include this lengthy description at first. But I still think that in general, being able to express the idea of mutually exclusive group (maybe via exec_properties, I thought) would be generally helpful.