runhistory

package
v0.0.0-...-22a63fd Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunHistory

type RunHistory struct {
	// contains filtered or unexported fields
}

The current active history of a run.

This is used to store the history of a run, which would be a single history line update for a specific step. The history is stored in a tree structure, where each node represents a key in the history. The leaves of the tree are the actual values of the history.

func New

func New() *RunHistory

func NewFrom

func NewFrom(tree pathtree.TreeData) *RunHistory

func NewWithStep

func NewWithStep(step int64) *RunHistory

NewWithStep creates a new RunHistory with the given step.

The step is the step of the run that this history is for.

func (*RunHistory) ApplyChangeRecord

func (rh *RunHistory) ApplyChangeRecord(
	historyRecord []*service.HistoryItem,
	onError func(error),
)

Updates values in the history tree.

Does a best-effort job to apply all changes. Errors are passed to `onError` and skipped.

func (*RunHistory) Flatten

func (rh *RunHistory) Flatten() ([]*service.HistoryItem, error)

Flatten returns a flat list of history items.

The items are ordered by their path, with nested items following their parent. If some item cannot be converted to a history item, an error is returned.

This is needed to send the history to the sender that expects a flat list of history items.

func (*RunHistory) GetStep

func (rh *RunHistory) GetStep() int64

func (*RunHistory) Serialize

func (rh *RunHistory) Serialize() ([]byte, error)

Serialize the object to send to the backend.

The object is serialized to a JSON string. This is needed to send the history to the the backend, which expects a JSON string.

func (*RunHistory) Tree

func (rh *RunHistory) Tree() pathtree.TreeData

Clone returns a deep copy of the history tree.

type RunHistorySampler

type RunHistorySampler struct {
	// contains filtered or unexported fields
}

RunHistorySampler tracks a sample of each metric in the run's history.

func NewRunHistorySampler

func NewRunHistorySampler() *RunHistorySampler

func (*RunHistorySampler) Get

Get returns all the samples.

func (*RunHistorySampler) SampleNext

func (s *RunHistorySampler) SampleNext(history *service.HistoryRecord)

SampleNext updates all samples with the next history row.

This must be called on history rows in order.

Jump to

Keyboard shortcuts

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