-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forward exec_properties
to main test spawn's execution info
#24979
base: master
Are you sure you want to change the base?
Conversation
89398ca
to
9dad1d3
Compare
This makes `exec_properties` such as `no-remote-exec` effective for the main test spawn, where it previously only affected post-processing spawns such as test XML generation.
9dad1d3
to
5091e1d
Compare
exec_properties
to main test spawn's execution info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me.
cc: @mortenmj @EdSchouten who might be relying platforms with "no-remote-exec" set.
# A my_test target includes 2 actions: 1 build action (a) and 1 test action (b), | ||
# with (b) running two spawns (test execution, test XML generation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it's less confusing to use either spawn or action and not both.
I thought that using the mnemonics directly might help, but afaik the test execution and xml generation have the same "TestRunner" mnemonic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we need to talk about both (with their precise meaning as in the Bazel codebase, not the user-facing docs) specifically because the bug this PR fixes is not visible on the action level (test actions have the correct execution info set), but shows up on the spawn level (that may or may not correctly inherit this information).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is an unfortunately important implementation detail for tests like this.
target_compatible_with = [":has_foo"], | ||
exec_properties = { | ||
"test.no-remote-exec": "1", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it would be better to keep the old test setup and add new targets for my_test
rule. That would show that the old behavior is unchanged for sh_test
(?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sh_test
no longer lives in the Bazel codebase and isn't versioned together with Bazel. Since this test necessarily depends on internals of the rule (the actions it registers), it wouldn't be self-contained if it used that rule.
In fact, the test in its previous state relied on sh_test
to register a "build action" that is also backed by a spawn, but sh_test
uses ctx.actions.symlink
, which is spawn-less. This hid the bug that the different test spawns used different execution infos. Using a custom rule defined within the test avoids this class of issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to self-contained tests.
src/test/java/com/google/devtools/build/lib/analysis/StarlarkExecGroupTest.java
Show resolved
Hide resolved
@katre What do you think about the issue of exec info pollution? Should we perhaps filter out |
@bazel-io fork 8.1.0 |
Ideally spawn strategies would filter out the properties they are interested in and only forward those. I'm not sure there's a good principled answer to this. As I said in another issue, I think that we need to collapse the distinctions between requirements, exec info, and exec properties (and remove magic tags as much as possible), but no one has the time to take that on (and it's complicated enough by internal blaze code that I'm not sure it's feasible for an external contributor to make headway on). |
@bazel-io fork 7.5.0 |
Going off the description, this makes sense to me. There is a capability missing here however. Specifying exec properties for the |
That is possible via the |
Ah, was not aware of that. Thanks for letting me know. |
This makes
exec_properties
such asno-remote-exec
effective for the main test spawn, where they previously only affected post-processing spawns such as test XML generation.Pros:
tags
) way to affect test execution using existing APICons:
exec_properties
such asOSFamily
andcontainer-image
, which shows up inaquery
and may increase memory usageexec_properties
end up in execution info appears to have been an unintentional side effect of adb56cc rather than a conscious design decision