taskhash

package
v0.0.0-...-0a43815 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package taskhash handles calculating dependency hashes for nodes in the task execution graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

type Tracker struct {
	EnvAtExecutionStart env.EnvironmentVariableMap

	PackageInputsHashes map[string]string

	// PackageInputsExpandedHashes is a map of a hashkey to a list of files that are inputs to the task.
	// Writes to this map happen during CalculateFileHash(). Since this happens synchronously
	// before walking the task graph, it does not need to be protected by a mutex.
	PackageInputsExpandedHashes map[string]map[turbopath.AnchoredUnixPath]string
	// contains filtered or unexported fields
}

Tracker caches package-inputs hashes, as well as package-task hashes. package-inputs hashes must be calculated before package-task hashes, and package-task hashes must be calculated in topographical order. package-task hashing is threadsafe, provided topographical order is respected.

func NewTracker

func NewTracker(rootNode string, globalHash string, envAtExecutionStart env.EnvironmentVariableMap, pipeline fs.Pipeline) *Tracker

NewTracker creates a tracker for package-inputs combinations and package-task combinations.

func (*Tracker) CalculateFileHashes

func (th *Tracker) CalculateFileHashes(
	allTasks []dag.Vertex,
	workerCount int,
	workspaceInfos workspace.Catalog,
	taskDefinitions map[string]*fs.TaskDefinition,
	repoRoot turbopath.AbsoluteSystemPath,
) error

CalculateFileHashes hashes each unique package-inputs combination that is present in the task graph. Must be called before calculating task hashes.

func (*Tracker) CalculateTaskHash

func (th *Tracker) CalculateTaskHash(logger hclog.Logger, packageTask *nodes.PackageTask, dependencySet dag.Set, frameworkInference bool, args []string) (string, error)

CalculateTaskHash calculates the hash for package-task combination. It is threadsafe, provided that it has previously been called on its task-graph dependencies. File hashes must be calculated first.

func (*Tracker) GetCacheStatus

func (th *Tracker) GetCacheStatus(taskID string) runsummary.TaskCacheSummary

GetCacheStatus records the task status for the given taskID

func (*Tracker) GetEnvVars

func (th *Tracker) GetEnvVars(taskID string) env.DetailedMap

GetEnvVars returns the hashed env vars for a given taskID

func (*Tracker) GetExpandedInputs

func (th *Tracker) GetExpandedInputs(packageTask *nodes.PackageTask) map[turbopath.AnchoredUnixPath]string

GetExpandedInputs gets the expanded set of inputs for a given PackageTask

func (*Tracker) GetExpandedOutputs

func (th *Tracker) GetExpandedOutputs(taskID string) []turbopath.AnchoredSystemPath

GetExpandedOutputs returns a list of outputs for a given taskID

func (*Tracker) GetFramework

func (th *Tracker) GetFramework(taskID string) string

GetFramework returns the inferred framework for a given taskID

func (*Tracker) GetTaskHashes

func (th *Tracker) GetTaskHashes() map[string]string

GetTaskHashes gets the package task hashes

func (*Tracker) SetCacheStatus

func (th *Tracker) SetCacheStatus(taskID string, cacheSummary runsummary.TaskCacheSummary)

SetCacheStatus records the task status for the given taskID

func (*Tracker) SetExpandedOutputs

func (th *Tracker) SetExpandedOutputs(taskID string, outputs []turbopath.AnchoredSystemPath)

SetExpandedOutputs a list of outputs for a given taskID so it can be read later

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL