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

Inline a constant so it's individualized to each task run #4735

Merged
merged 1 commit into from Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions cli/internal/run/real_run.go
Expand Up @@ -215,8 +215,9 @@ func (ec *execContext) logError(prefix string, err error) {
func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTask) (*runsummary.TaskExecutionSummary, error) {
// Setup tracer. Every time tracer() is called the taskExecutionSummary's duration is updated
// So make sure to call it before returning.
tracer, taskExecutionSummary := ec.runSummary.RunSummary.TrackTask(packageTask.TaskID)
successExitCode := 0 // We won't use this till later

tracer, taskExecutionSummary := ec.runSummary.RunSummary.TrackTask(packageTask.TaskID)
progressLogger := ec.logger.Named("")
progressLogger.Debug("start")

Expand All @@ -236,7 +237,7 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas
}

// Set building status now that we know it's going to run.
tracer(runsummary.TargetBuilding, nil, &successCode)
tracer(runsummary.TargetBuilding, nil, &successExitCode)

var prefix string
var prettyPrefix string
Expand Down Expand Up @@ -273,8 +274,8 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas
prefixedUI.Error(fmt.Sprintf("error fetching from cache: %s", err))
} else if cacheStatus.Local || cacheStatus.Remote { // If there was a cache hit
ec.taskHashTracker.SetExpandedOutputs(packageTask.TaskID, taskCache.ExpandedOutputs)
// We only cache successful executions, so we can assume this is a successCode exit.
tracer(runsummary.TargetCached, nil, &successCode)
// We only cache successful executions, so we can assume this is a successExitCode exit.
tracer(runsummary.TargetCached, nil, &successExitCode)
return taskExecutionSummary, nil
}

Expand Down Expand Up @@ -411,9 +412,8 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas
}

// Clean up tracing
tracer(runsummary.TargetBuilt, nil, &successCode)

tracer(runsummary.TargetBuilt, nil, &successExitCode)
progressLogger.Debug("done", "status", "complete", "duration", taskExecutionSummary.Duration)
return taskExecutionSummary, nil
}

var successCode = 0