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

Replace ProcessCacheScope.PER_RESTART with ProcessCacheScope.PER_RESTART_ALWAYS and ProcessCacheScope.PER_RESTART_SUCCESSFUL #12094

Merged
merged 2 commits into from May 20, 2021

Conversation

Eric-Arellano
Copy link
Contributor

Previously, ProcessCacheScope.PER_RESTART always memoized failures (but not cached to disk).

That wasn't a problem in pantsbuild/pants because we always use await Get(ProcessResult, Process) instead of Get(FallibleProcessResult, Process), and the error restarts Pantsd.

But, it's valid to use a fallible process result and not want to memoize failures. For example, a user is writing a plugin to check if a database is alive before test runs. They must not cache this to disk because it's not safe to, but they also don't want to have to run the check every single distinct test run.

[ci skip-build-wheels]

…ESTART_ALWAYS` and `ProcessCacheScope.PER_RESTART_SUCCESSFUL`

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link
Contributor Author

@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.

I tried to deprecate this by overriding __new__, but it resulted in the warning happening every time on loading Pants because Python apparently creates each enum value upon initializing the module, even if there are no call sites for that particular member.

Copy link
Contributor

@tdyas tdyas left a comment

Choose a reason for hiding this comment

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

lgtm

# 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]
@Eric-Arellano Eric-Arellano merged commit 2401726 into pantsbuild:main May 20, 2021
@Eric-Arellano Eric-Arellano deleted the per-restart branch May 20, 2021 19:23
@wisechengyi wisechengyi mentioned this pull request May 30, 2021
@stuhood
Copy link
Sponsor Member

stuhood commented Jun 7, 2021

and the error restarts Pantsd.

Mentioned elsewhere, but this should not be the case (except during initialization).

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

Successfully merging this pull request may close these issues.

None yet

3 participants