Documentation ¶
Index ¶
- type Prediction
- type Predictor
- func (p *Predictor) Predict(ctx context.Context, tasks ...*sched.Task) map[*sched.Task]Prediction
- func (p *Predictor) QueryPercentile(profiles []reflow.Profile, name string, pct float64) (float64, int, error)
- func (p *Predictor) QueryProfiles(ctx context.Context, q ProfileQuery) ([]reflow.Profile, error)
- type ProfileQuery
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 ¶
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 ¶
QueryProfiles returns a list of profiles matching the given ProfileQuery.
type ProfileQuery ¶
ProfileQuery is used to query profiles. One of its fields has to be specified.