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

Begin migration to explicitly scoped environments #17155

Merged
merged 3 commits into from
Oct 11, 2022

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Oct 7, 2022

As described in #17129: we would like @goal_rules to eventually make their own decisions about which environments to use, generally by consuming targets to do so, but possibly also by pinning themselves to other environments via configuration.

This change builds on #17179, and introduces a migration from Goal.environment_migrated = {False => True}. All graph-introspection goals consume only the APIs which are pinned to the local environment by #17179, and so are trivially migrated here. Other goals trigger a deprecation warning like the following:

DEPRECATED: Not setting `Goal.environment_migrated=True` for `Goal` `generate-lockfiles` is scheduled to be removed in version 2.17.0.dev0.

See https://www.pantsbuild.org/v2.15/docs/plugin-upgrade-guide

Before calling #17129 done, we will migrate all internal goals to Goal.environment_migrated=True.

[ci skip-rust]
[ci skip-build-wheels]

@stuhood stuhood changed the title Begin migration to explicitly scope environments Begin migration to explicitly scoped environments Oct 7, 2022
@stuhood stuhood force-pushed the stuhood/environment-scoping branch 6 times, most recently from a69bc66 to c725edc Compare October 10, 2022 19:54
@stuhood stuhood marked this pull request as ready for review October 10, 2022 20:10
@stuhood
Copy link
Member Author

stuhood commented Oct 10, 2022

Only the top two commits are relevant: the rest are #17179.


Then, the `EnvironmentName` should be used at `Get` callsites which require an environment:
```python
Get(TestResult, {field_set: TestFieldSet, environment_name: EnvironmentName})
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do the values for field_set and environment_name come from here?

Copy link
Contributor

Choose a reason for hiding this comment

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

(in the cases that I've seen these, field_set and environment_name come from a non-obvious preceding Get; it looks similar in this case too)

Copy link
Member Author

Choose a reason for hiding this comment

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

They come from the Get that is shown a few lines up.

I expect that one of our migration PRs should update this doc to reference itself as a complete example of migrating a goal.

Copy link
Contributor

@chrisjrn chrisjrn left a comment

Choose a reason for hiding this comment

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

This seems fine

…equest an environment.

[ci skip-rust]
[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@stuhood stuhood force-pushed the stuhood/environment-scoping branch from c725edc to 7e66fc7 Compare October 11, 2022 01:46
@stuhood stuhood enabled auto-merge (squash) October 11, 2022 01:46
@stuhood stuhood merged commit 0b6eee2 into pantsbuild:main Oct 11, 2022
@stuhood stuhood deleted the stuhood/environment-scoping branch October 11, 2022 04:07
stuhood added a commit that referenced this pull request Oct 11, 2022
As part of #17155, migrates the `test` goal to explicitly scoped environments.

[ci skip-rust]
[ci skip-build-wheels]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Lg, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants