Skip to content

Commit

Permalink
Add more context into cache hits when outputs haven't changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulkar committed Jun 2, 2023
1 parent cb50968 commit f382367
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cli/internal/runcache/runcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,24 @@ func (tc *TaskCache) RestoreOutputs(ctx context.Context, prefixedUI *cli.Prefixe
Source: cache.CacheSourceFS,
TimeSaved: timeSavedFromDaemon,
}
prefixedUI.Warn(fmt.Sprintf("Configured outputs are already in place for %s, skipping cache check", tc.pt.TaskID))
}

// Some more context to add into the cache hit messages.
// This isn't the cleanest way to updat ethe log message, so we should revisit during Rust port.
moreContext := ""
if !hasChangedOutputs {
moreContext = "(outputs already on disk)"
}

switch tc.taskOutputMode {
// When only showing new task output, cached output should only show the computed hash
case util.NewTaskOutput:
fallthrough
case util.HashTaskOutput:
prefixedUI.Info(fmt.Sprintf("cache hit, suppressing output %s", ui.Dim(tc.hash)))
prefixedUI.Info(fmt.Sprintf("cache hit %s, suppressing output %s", moreContext, ui.Dim(tc.hash)))
case util.FullTaskOutput:
progressLogger.Debug("log file", "path", tc.LogFileName)
prefixedUI.Info(fmt.Sprintf("cache hit, replaying output %s", ui.Dim(tc.hash)))
prefixedUI.Info(fmt.Sprintf("cache hit %s, replaying output %s", moreContext, ui.Dim(tc.hash)))
tc.ReplayLogFile(prefixedUI, progressLogger)
case util.ErrorTaskOutput:
// The task succeeded, so we don't output anything in this case
Expand Down

0 comments on commit f382367

Please sign in to comment.