nthsectionsnapshot

package
v0.0.0-...-9816dab Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package nthsectionsnapshot contains the logic for getting the current state for nthsection analysis and get the next commits to run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRangeError

type BadRangeError struct {
	FirstFailedIdx int
	LastPassedIdx  int
}

BadRangeError suggests the regression range is invalid. For example, if a passed rerun is found that is more recent than a failed rerun, the regression range is invalid.

func (*BadRangeError) Error

func (b *BadRangeError) Error() string

type NthSectionSnapshotChunk

type NthSectionSnapshotChunk struct {
	Begin int
	End   int
}

type Run

type Run struct {
	// Index of the run (on the blamelist).
	Index  int
	Commit string
	Status pb.RerunStatus       // status of the run
	Type   model.RerunBuildType // Whether this is nth-section or culprit verification run
}

type Snapshot

type Snapshot struct {
	BlameList *pb.BlameList
	// Runs are sorted by index
	Runs []*Run
	// We want a way to detect infinite loop where there is some "consistent" infra failure
	// for a builder, and nth section keep retrying for that builder, and
	// draining the resources.
	// In such cases, keep track of the number of infra failed rerun, and if
	// there are too many, don't run any more
	NumInfraFailed int
	// NumInProgress is the number of reruns that are currently running.
	NumInProgress int
	// NumTestSkipped is the number of reruns with the TEST_SKIPPED status.
	// It indicates that the primary test failure was not executed, so we
	// may not know the next commit for bisection.
	NumTestSkipped int
}

Snapshot contains the current snapshot of the nth-section run Including the blamelist, status of the reruns...

func (*Snapshot) FindNextCommitsToRun

func (snapshot *Snapshot) FindNextCommitsToRun(n int) ([]string, error)

FindNextCommitsToRun is similar to FindNextIndicesToRun, but it returns the commit hashes instead of indices.

func (*Snapshot) FindNextIndicesToRun

func (snapshot *Snapshot) FindNextIndicesToRun(n int) ([]int, error)

FindNextIndicesToRun finds at most n next commits to run for nthsection. At most n indices will be returned The target is to minimize the biggest chunks For example, if the regression is [0..9], and n=3, We can run at indices 2, 5, 8 to break the range into 4 "chunks" [0-1], [3-4], [6-7], [9]. The biggest chunk is of size 2.

func (*Snapshot) FindNextSingleCommitToRun

func (snapshot *Snapshot) FindNextSingleCommitToRun() (string, error)

FindNextSingleCommitToRun returns the next commit to run. Used to get the new rerun when we get the update from recipe. If we cannot find the next commit, we will return empty string.

func (*Snapshot) GetCulprit

func (snapshot *Snapshot) GetCulprit() (bool, int)

GetCulprit returns the result of NthSection The first return value will be true iff there is a result Second value will be the index of the culprit in the blamelist

func (*Snapshot) GetCurrentRegressionRange

func (snapshot *Snapshot) GetCurrentRegressionRange() (int, int, error)

GetCurrentRegressionRange will return a pair of indices from the Snapshot that contains the culprit, based on the results of the rerun. Note: In the snapshot blamelist, index 0 refer to first failed, and index (n-1) refer to the commit after last pass. This function will return an BadRangeError if the regression range is invalid.

func (*Snapshot) HasTooManyInfraFailure

func (snapshot *Snapshot) HasTooManyInfraFailure() bool

Jump to

Keyboard shortcuts

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