predictor

package
v0.0.0-...-90deddd Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prediction

type Prediction struct {
	// Resources is the predicted amount of resources a task is expected to require.
	Resources reflow.Resources
	// Duration is the predicted duration of a task.  Currently this is populated with
	// the duration of the task's `exec` and does not include load/unload times, etc.
	// TODO(swami): Predict and use total task duration instead.
	Duration time.Duration
}

Prediction consists of various predicted attributes.

type Predictor

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

Predictor predicts tasks' resource usage. All predictions are performed online using cached profiling data.

func New

func New(tdb taskdb.TaskDB, log *log.Logger, minData, maxInspect int, memPercentile float64) *Predictor

New returns a new Predictor instance. New will panic if either repo or tdb is nil because a Predictor requires both a taskdb and a repository to function. NewPred will also panic if minData <= 0 because a prediction requires at least one data point.

func (*Predictor) Predict

func (p *Predictor) Predict(ctx context.Context, tasks ...*sched.Task) map[*sched.Task]Prediction

Predict returns the predicted Resources of submitted tasks. If Predict fails to predict the Resources of a particular task, it will return no resources for the task.

func (*Predictor) QueryPercentile

func (p *Predictor) QueryPercentile(profiles []reflow.Profile, name string, pct float64) (float64, int, error)

QueryPercentile computes the 'p'th percentile for the statistic 'name' across the given profiles. QueryPercentile also returns n, ie, the number of values used to compute the returned percentile and an error (if any).

func (*Predictor) QueryProfiles

func (p *Predictor) QueryProfiles(ctx context.Context, q ProfileQuery) ([]reflow.Profile, error)

QueryProfiles returns a list of profiles matching the given ProfileQuery.

type ProfileQuery

type ProfileQuery struct {
	ImgCmdId taskdb.ImgCmdID
	Ident    string
}

ProfileQuery is used to query profiles. One of its fields has to be specified.

Jump to

Keyboard shortcuts

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