Skip to content
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

Expand experimental_add_exec_constraints_to_targets to support mnemonics #23606

Open
keith opened this issue Sep 11, 2024 · 2 comments
Open

Expand experimental_add_exec_constraints_to_targets to support mnemonics #23606

keith opened this issue Sep 11, 2024 · 2 comments
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions type: feature request untriaged

Comments

@keith
Copy link
Member

keith commented Sep 11, 2024

Description of the feature request:

--experimental_add_exec_constraints_to_targets is super useful for some things like "give all these targets this constraint", but for some custom rules it would also be useful to do this for entire mnemonics. For example if you have a custom rule that always does a heavy compilation action, adding a large remote exec machine constraint to all targets of that type can be useful. This can be done with exec_groups but sometimes it's desirable to do this only temporarily like if you want to run a set of tests against a machine with a GPU just once.

Which category does this issue belong to?

No response

What underlying problem are you trying to solve with this feature?

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@satyanandak satyanandak added the team-Configurability platforms, toolchains, cquery, select(), config transitions label Sep 12, 2024
@katre
Copy link
Member

katre commented Oct 4, 2024

Okay, first, the actual answer to your request: this isn't possible, because exec constraints are relevant before actions are created, and so before action mnemonics are known.

The flow during analysis is (roughly):

  1. Toolchain resolution
    1. Based on the configuration, the requested toolchain types, and any target-specific exec constraints, the specific toolchain implementations and exec platforms are chosen
  2. Other dependencies are resolved
  3. The rule implementation is invoked
    1. The rule implementation then creates actions, based on the dependencies and toolchains from the previous steps.

Because of this, it's not possible to check mnemonics and add exec constraints, and if it were possible, it would be too late.

@katre
Copy link
Member

katre commented Oct 4, 2024

Secondly, the --experimental_add_exec_constraints_to_targets flag was added for a migration that is now completed, and barring any heavy use I think we should get rid of it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions type: feature request untriaged
Projects
None yet
Development

No branches or pull requests

5 participants