Documentation ¶
Overview ¶
Package nthsectionsnapshot contains the logic for getting the current state for nthsection analysis and get the next commits to run.
Index ¶
- type BadRangeError
- type NthSectionSnapshotChunk
- type Run
- type Snapshot
- func (snapshot *Snapshot) FindNextCommitsToRun(n int) ([]string, error)
- func (snapshot *Snapshot) FindNextIndicesToRun(n int) ([]int, error)
- func (snapshot *Snapshot) FindNextSingleCommitToRun() (string, error)
- func (snapshot *Snapshot) GetCulprit() (bool, int)
- func (snapshot *Snapshot) GetCurrentRegressionRange() (int, int, error)
- func (snapshot *Snapshot) HasTooManyInfraFailure() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadRangeError ¶
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 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 ¶
FindNextCommitsToRun is similar to FindNextIndicesToRun, but it returns the commit hashes instead of indices.
func (*Snapshot) FindNextIndicesToRun ¶
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 ¶
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 ¶
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 ¶
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.