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

Fix logs for test, lint, fmt, and typecheck to always print, even if cached (Cherry-pick of #11111) #11116

Merged
merged 1 commit into from Nov 9, 2020

Conversation

Eric-Arellano
Copy link
Contributor

[ci skip-rust]

…even if cached (pantsbuild#11111)

Closes pantsbuild#10918.

Rather than inventing some new engine mechanism like a `force_log=True` toggle—which would be costly to maintain—we leverage uncachable rules. We use a pattern where the downstream plugins return the data (e.g. `LintResults`), and then we automatically enrich it for the sake of IO (e.g. `EnrichedLintResults`). This ensures that the data computation is memoized, while the IO is forced to rerun. As we were doing before, we can augment the logging with extra info, e.g. using `--test-output` to determine what to log.

### Result

Regardless of how many times you run this command, we get consistent output (modulo inconsistent ordering of logs):

```
▶ ./pants --changed-since=HEAD~1 lint
01:26:44.10 [INFO] Completed: lint - Docformatter succeeded.
01:26:44.21 [INFO] Completed: lint - isort succeeded.
01:26:44.51 [INFO] Completed: lint - Flake8 succeeded.
01:26:44.75 [INFO] Completed: lint - Black succeeded.
All done! ✨ 🍰 ✨
8 files would be left unchanged.
```

[ci skip-rust]
[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.

Cherry-pick with no modifications.

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

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 25b77af on Eric-Arellano:cp-logs into 937f86a on pantsbuild:2.0.x.

@Eric-Arellano Eric-Arellano merged commit da66fd0 into pantsbuild:2.0.x Nov 9, 2020
@Eric-Arellano Eric-Arellano deleted the cp-logs branch November 9, 2020 20:32
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