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: add extra detail to summary showing items from remote cache #7697

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arlyon
Copy link
Contributor

@arlyon arlyon commented Mar 11, 2024

Description

A quick fix that closes #2129

It adds a small additional UI when tasks are loaded from the remote
cache. Tasks that were not fetched from cache do not have the extra
annotation and retain the original formatting.

Testing Instructions

Run a build with remote cache set up:

Tasks: 0 successful, 2 total
Cached: 2 (of which 2 remote) cached, 2 total
Time: 1.141s

Run another build:

Tasks: 0 successful, 2 total
Cached: 2 cached, 2 total
Time: 1.141s

Closes TURBO-2590

@arlyon arlyon requested a review from a team as a code owner March 11, 2024 18:34
Copy link

vercel bot commented Mar 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 2:32pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 2:32pm
9 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm
rust-docs ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2024 2:32pm

Copy link
Contributor

github-actions bot commented Mar 11, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Mar 11, 2024

🟢 CI successful 🟢

Thanks

@@ -159,14 +168,23 @@ impl<'a> ExecutionSummary<'a> {
fn successful(&self) -> usize {
self.success + self.cached
}

fn add_cached(&mut self, source: CacheSource) {
self.cached += 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To preserve run summary output we just add a new field for remote rather than splitting into two. Naturally cached - cached_remote = cached_local if we need it one day.

@@ -159,14 +168,23 @@ impl<'a> ExecutionSummary<'a> {
fn successful(&self) -> usize {
self.success + self.cached
}

fn add_cached(&mut self, source: CacheSource) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this used anywhere so I think it can get removed? In general I think we don't want to be changing the counts on the ExecutionSummary and have all modifications happen to SummaryState

@@ -82,6 +86,12 @@ impl<'a> ExecutionSummary<'a> {
String::new()
};

let cache_line = if self.cached_remote > 0 {
format!("{} (of which {} remote)", self.cached, self.cached_remote)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't want to bikeshed this a ton, but I feel like we can simplify this to just 10 (8 remote) or 10 (2 local, 8 remote).

Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

I'd love to see something like this in our run summary:

interface Cache {
   restoredFrom: "local" | "remote" | undefined,
   hit: {
      local: boolean | "unknown",
      remote: boolean | "unknown",
   },
   enabled: {
      local: boolean,
      remote: boolean,
   }
};

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.

improve output when using remote caching
3 participants