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

Get rid of bootstrap_option_values in Options instance. #21772

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Dec 17, 2024

If you have an Options instance you can get the individual
values from the global scope, since every bootstrap
option is a regular global scope option
(the "bootstrap" designation just means "needed for
creating a Scheduler").

Or, if you need all the bootstrap options in a single
OptionValueContainer (say, to pass them en masse
to Scheduler initialization) then you can get that
directly from the OptionsBootstrapper.

@benjyw benjyw added the category:internal CI, fixes for not-yet-released features, etc. label Dec 17, 2024
@benjyw benjyw requested review from huonw and tdyas December 17, 2024 17:16
@@ -438,17 +438,16 @@ def from_options(
prior_result: AuthPluginResult | None = None,
remote_auth_plugin_func: Callable | None = None,
) -> tuple[DynamicRemoteOptions, AuthPluginResult | None]:
bootstrap_options = full_options.bootstrap_option_values()
assert bootstrap_options is not None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to assert this now, as we know for_global_scope() always returns an object.

execution = cast(bool, bootstrap_options.remote_execution)
cache_read = cast(bool, bootstrap_options.remote_cache_read)
cache_write = cast(bool, bootstrap_options.remote_cache_write)
global_options = full_options.for_global_scope()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of bootstrap options was always gratuitous here. We have a fully formed Options instance, so these are just regular global options now.

@benjyw
Copy link
Contributor Author

benjyw commented Dec 17, 2024

Continuing to chip away at the complexities of OptionsBootstrapper, so we can delegate most of it to Rust...

@benjyw benjyw requested a review from cburroughs December 17, 2024 20:14
Copy link
Contributor

@huonw huonw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. Is this potentially a plugin API change that we should call out in release notes?

@benjyw
Copy link
Contributor Author

benjyw commented Dec 18, 2024

Looks fine. Is this potentially a plugin API change that we should call out in release notes?

It shouldn't be. This is all in the options bootstrapping sequence, which we have never considered part of the API. You're supposed to request subsystem instances from the engine, not manipulate a raw Options instance.

That said, good idea to call this out in the release notes, just in case.

@benjyw benjyw merged commit 9c7441f into pantsbuild:main Dec 18, 2024
24 checks passed
@benjyw benjyw deleted the get_bs_options_from_bootstrapper branch December 18, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants