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

Filter spawn strategies by execution platform #24265

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Silic0nS0ldier
Copy link
Contributor

@Silic0nS0ldier Silic0nS0ldier commented Nov 11, 2024

This PR implements part of the Execution Platform Scoped Spawn Strategies proposal.

It adds a new flag --allowed_strategies_by_exec_platform which permits filtering spawn strategies for spawns execution platform.

Example

# //.bazelrc
# Default strategies (order sensitive)
build --spawn_strategy=remote,worker,sandboxed,local

# Mnemonic targeted strategy override (order sensitive)
build --strategy=BAR=remote,sandboxed

# Host platform allowed strategies
build --allowed_strategies_by_exec_platform=@platforms//host:host=local,sandboxed,worker

# Remote platform allowed strategies
build --allowed_strategies_by_exec_platform=//:remote_platform=remote

For an action with mnemonic FOO configured for the host platform (@platforms//host:host), it will resolve worker,sandboxed,local as it's spawn strategy candidates.

  • remote was eliminated as a candidate (not in allow list for platform).
  • Order from --spawn_strategy was preserved.

For an action with mnemonic BAR configured for the host platform (@platforms//host:host), it will resolve sandboxed as it's spawn strategy candidate.

  • remote was eliminated as a candidate (not in allow list for platform).
  • Mnemonic override applied, leaving sandboxed as the final candidate.

For an action with mnemonic BAR configured for the remote platform (//:remote_platform), it will resolve remote as it's spawn strategy candidate.

  • sandboxed was eliminated as a candidate (not in allow list for platform).
  • Mnemonic override applied, leaving remote as the final candidate.

If no spawn strategy candidate remains after filtering, the standard error will be logged.

ERROR: /workspaces/___/BUILD.bazel:3:22: _description_ [for tool] failed: _mnemonic_ spawn cannot be executed with any of the available strategies: []. Your --spawn_strategy, --genrule_strategy and/or --strategy flags are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for advice

TODO

  • Update "spawn cannot be executed" error to include new strategy flag.
  • CoverageReportActionBuilder.CoverageReportAction action uses spawn machinery but lacks an execution platform, leading to a precondition check failure. Being resolved in Give builtin actions a platform #23231

@Silic0nS0ldier Silic0nS0ldier marked this pull request as ready for review November 11, 2024 03:46
@Silic0nS0ldier Silic0nS0ldier requested a review from a team as a code owner November 11, 2024 03:46
@github-actions github-actions bot added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Nov 11, 2024
@Silic0nS0ldier
Copy link
Contributor Author

cc @katre

@meisterT meisterT requested review from katre and tjgq November 11, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-Remote-Exec Issues and PRs for the Execution (Remote) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant