experiment

package
v2.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PhaseCreated indicates that the experiment has been created on the remote server but is not receiving trials
	PhaseCreated string = "Created"
	// PhasePaused indicates that the experiment has been paused, i.e. the desired replica count is zero
	PhasePaused = "Paused"
	// PhaseEmpty indicates there is no record of trials being run in the cluster
	PhaseEmpty = "Never run" // TODO This is misleading, it could be that we already deleted the trials that ran
	// PhaseIdle indicates that the experiment is waiting for trials to be manually created
	PhaseIdle = "Idle"
	// PhaseRunning indicates that there are actively running trials for the experiment
	PhaseRunning = "Running"
	// PhaseCompleted indicates that the experiment has exhausted it's trial budget and is no longer expecting new trials
	PhaseCompleted = "Completed"
	// PhaseFailed indicates that the experiment has failed
	PhaseFailed = "Failed"
	// PhaseDeleted indicates that the experiment has been deleted and is waiting for trials to be cleaned up
	PhaseDeleted = "Deleted"
)

TODO Make the constant names better reflect the code, not the text

View Source
const (
	// HasTrialFinalizer is a finalizer that indicates an experiment has at least one trial
	HasTrialFinalizer = "hasTrialFinalizer.stormforge.io"
)

Variables

This section is empty.

Functions

func ApplyCondition

func ApplyCondition(status *optimizev1beta2.ExperimentStatus, conditionType optimizev1beta2.ExperimentConditionType, conditionStatus corev1.ConditionStatus, reason, message string, time *metav1.Time)

func FailExperiment

func FailExperiment(exp *optimizev1beta2.Experiment, reason string, err error) bool

FailExperiment records a recognized error as an experiment failure.

func IsFinished

func IsFinished(exp *optimizev1beta2.Experiment) bool

func NextTrialNamespace

func NextTrialNamespace(ctx context.Context, c client.Client, exp *optimizev1beta2.Experiment, trialList *optimizev1beta2.TrialList) (string, error)

NextTrialNamespace searches for or creates a new namespace to run a new trial in, returning an empty string if no such namespace can be found

func ParameterConstant added in v2.1.0

func ParameterConstant(p optimizev1beta2.Parameter) *intstr.IntOrString

ParameterConstant returns the value of the supplied parameter if it is constant. A constant parameter has a domain which includes exactly 1 value (i.e. min==max for numeric, or len(values)==1 for categorical); these parameters are not processed on the server.

func PopulateTrialFromTemplate

func PopulateTrialFromTemplate(exp *optimizev1beta2.Experiment, t *optimizev1beta2.Trial)

PopulateTrialFromTemplate creates a new trial for an experiment

func StopExperiment

func StopExperiment(exp *optimizev1beta2.Experiment, err error) bool

StopExperiment updates the experiment in the event that it should be paused or halted.

func UpdateStatus

func UpdateStatus(exp *optimizev1beta2.Experiment, trialList *optimizev1beta2.TrialList) bool

UpdateStatus will ensure the experiment's status matches what is in the supplied trial list; returns true only if changes were necessary

func Walk

func Walk(ctx context.Context, v Visitor, obj interface{})

Walk traverses an experiment depth first; obj must not be nil; visitor will be invoked with relevant non-nil members of the experiment followed by an invocation with nil.

func WalkPath

func WalkPath(ctx context.Context) []string

WalkPath returns the path to current element on the context as an array of element names.

Types

type Generator

type Generator struct {
	// The definition of the application to generate an experiment for.
	Application optimizeappsv1alpha1.Application
	// The name of the experiment to generate.
	ExperimentName string
	// The name of the scenario to generate an experiment for. Required if there are more then one scenario.
	Scenario string
	// The name of the objective to generate an experiment for. Required if there are more then one set of objectives.
	Objective string
	// IncludeApplicationResources is a flag indicating that the application resources should be included in the output.
	IncludeApplicationResources bool
	// Configure the filter options.
	scan.FilterOptions
}

Generator is used to create an experiment definition.

func (*Generator) Execute

func (g *Generator) Execute(output kio.Writer) error

Execute the experiment generation pipeline, sending the results to the supplied writer.

type MetadataAnnotations added in v2.0.1

type MetadataAnnotations map[string]string

MetadataAnnotations is a marker type to identify the `ObjectMeta.Annotations` map.

type MetadataLabels added in v2.0.1

type MetadataLabels map[string]string

MetadataLabels is a marker type to identify the `ObjectMeta.Labels` map.

type Visitor

type Visitor interface {
	// Visit an experiment section. The supplied object will be a slice or a pointer
	// to a type on the experiment. The return value is used to halt traversal.
	Visit(ctx context.Context, obj interface{}) Visitor
}

Visitor is used to inspect individual sections of an experiment.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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