-
Notifications
You must be signed in to change notification settings - Fork 226
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
How do I perform BXL analysis over targets with incompatible configurations? #757
Comments
What I think was happening is that my toolchains contained I'm leaving this issue open as it seems that this could be improved with better error messages or, ideally, a way to not have to specify a single execution platform when running BXL scripts. |
I didn't understand anything, but I'd like to help. Why don't you enable execution platforms globally for everything? In our internal setup it looks like this:
And this target lists all possible platforms — linux, mac, windows, different cpus etc.
You don't specify |
Right, sorry about not being clear enough, to be honest I'm not sure I understand everything that is/was going on, but my current mental model is that I got the error I posted because a BXL analysis that I ran with a specific execution platform depended on toolchain dependencies that were incompatible with that target platform. I got rid of the There are a few reasons why we don't set
If it is possible to use multiple execution platforms, how is one picked when running I hope that this clarifies things a little, thanks for you help! |
These are very different. There's a list of execution platforms, for example, it can be windows then linux (local linux and remote execution windows). In single build, one target can be executed locally on linux, and another one remotely on windows.
There's some documentation there https://buck2.build/docs/rule_authors/configurations/#execution-platform-resolution One platform is registered with
If you plan to use these, consider
From documentation there: https://buck2.build/docs/api/bxl/bxl.Context/#bxlcontextbxl_actions
Yes. |
I think I see where the disconnect is, it seems like your execution platforms are quite low level (OS/CPU/RBE constraints). |
Ok, I did that and it is working as intended. I would like to further untangle our target and execution platforms though: could you explain to me which providers should each provide?
def _execution_platforms_impl(ctx: AnalysisContext) -> list[Provider]:
return [
DefaultInfo(),
ExecutionPlatformRegistrationInfo(platforms = [p[ExecutionPlatformInfo] for p in ctx.attrs.platforms]),
]
execution_platforms = rule(
impl = _execution_platforms_impl,
attrs = {
"platforms": attrs.list(attrs.dep(providers = [ExecutionPlatformInfo])),
},
) Once I have answers to those, I can make a PR to add this information to the docs: would this be welcome, and if so, can I tag you as reviewer? Thanks again for your help. |
Every rule must provide (Although we are slowly migrating to configuration factories/modifiers. In the distant future
You mean, execution platforms? Check here an example of (this is used in e2e tests; e2e tests were exported to GitHub today, but they are not executed on external CI yet). Actual implementation of
If you can do it without spending too much time on it, please. Otherwise I'll do it myself.
Yep. |
Consider a BXL script that needs to both perform actions via
ctx.bxl_actions().actions
and run analysis viactx.analysis()
.We must enable execution platforms for the actions to work, via
-c build.execution_platforms=//my:platform
. However, this breaks analysis when the target pattern includes transitioned targets (both via rule transitions andattrs.configured_dep()
) or in general when not all targets are compatible with the same configuration. This will look something like this:I have tried setting the
target_platform
andskip_incompatible
parameters toctx.analysis()
, but this made no difference.Here are my observations:
Note that the analysis runs fine when I don't set an execution platform, but again this is not an option in order to use actions. I'm not sure which side of the problem should be "fixed" in this case.
If anyone has experience dealing with such a situtation (BXL analysis over configuration-incompatible targets and running actions in the same script), I'd be very interested in hearing about how they do that.
The text was updated successfully, but these errors were encountered: