Documentation

Overview

Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package v1beta1 contains API Schema definitions for the experiment v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=experiment.kubeflow.org

Package v1beta1 contains API Schema definitions for the experiment v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=experiments.kubeflow.org

Index

Constants

View Source
const (
	// DefaultTrialParallelCount is the default value of spec.parallelTrialCount.
	DefaultTrialParallelCount = 3

	// DefaultResumePolicy is the default value of spec.resumePolicy.
	DefaultResumePolicy = LongRunning

	// DefaultJobSuccessCondition is the default value of spec.trialTemplate.successCondition for Job.
	DefaultJobSuccessCondition = "status.conditions.#(type==\"Complete\")#|#(status==\"True\")#"

	// DefaultJobFailureCondition is the default value of spec.trialTemplate.failureCondition for Job.
	DefaultJobFailureCondition = "status.conditions.#(type==\"Failed\")#|#(status==\"True\")#"

	// DefaultKubeflowJobSuccessCondition is the default value of spec.trialTemplate.successCondition for Kubeflow Job.
	DefaultKubeflowJobSuccessCondition = "status.conditions.#(type==\"Succeeded\")#|#(status==\"True\")#"

	// DefaultKubeflowJobFailureCondition is the default value of spec.trialTemplate.failureCondition for Kubeflow Job.
	DefaultKubeflowJobFailureCondition = "status.conditions.#(type==\"Failed\")#|#(status==\"True\")#"
)
View Source
const (
	Group   = "kubeflow.org"
	Version = "v1beta1"
)

Variables

View Source
var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var (
	// DefaultKubeflowJobPrimaryPodLabels is the default value of spec.trialTemplate.primaryPodLabels for Kubeflow Job.
	DefaultKubeflowJobPrimaryPodLabels = map[string]string{"job-role": "master"}
)

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource is required by pkg/client/listers/...

Types

type ConfigMapSource

type ConfigMapSource struct {
	// Name of config map where trial template is located
	ConfigMapName string `json:"configMapName,omitempty"`

	// Namespace of config map where trial template is located
	ConfigMapNamespace string `json:"configMapNamespace,omitempty"`

	// Path in config map where trial template is located
	TemplatePath string `json:"templatePath,omitempty"`
}

ConfigMapSource references the config map where trial template is located

func (*ConfigMapSource) DeepCopy

func (in *ConfigMapSource) DeepCopy() *ConfigMapSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapSource.

func (*ConfigMapSource) DeepCopyInto

func (in *ConfigMapSource) DeepCopyInto(out *ConfigMapSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Experiment

type Experiment struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ExperimentSpec   `json:"spec,omitempty"`
	Status ExperimentStatus `json:"status,omitempty"`
}

Structure of the Experiment custom resource. +k8s:openapi-gen=true +kubebuilder:subresource:status

func (*Experiment) DeepCopy

func (in *Experiment) DeepCopy() *Experiment

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Experiment.

func (*Experiment) DeepCopyInto

func (in *Experiment) DeepCopyInto(out *Experiment)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Experiment) DeepCopyObject

func (in *Experiment) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Experiment) GetLastConditionType

func (exp *Experiment) GetLastConditionType() (ExperimentConditionType, error)

func (*Experiment) HasRunningTrials

func (exp *Experiment) HasRunningTrials() bool

func (*Experiment) IsCompleted

func (exp *Experiment) IsCompleted() bool

func (*Experiment) IsCompletedReason

func (exp *Experiment) IsCompletedReason(reason string) bool

func (*Experiment) IsCreated

func (exp *Experiment) IsCreated() bool

func (*Experiment) IsFailed

func (exp *Experiment) IsFailed() bool

func (*Experiment) IsRestarting

func (exp *Experiment) IsRestarting() bool

func (*Experiment) IsRunning

func (exp *Experiment) IsRunning() bool

func (*Experiment) IsSucceeded

func (exp *Experiment) IsSucceeded() bool

func (*Experiment) MarkExperimentStatusCreated

func (exp *Experiment) MarkExperimentStatusCreated(reason, message string)

func (*Experiment) MarkExperimentStatusFailed

func (exp *Experiment) MarkExperimentStatusFailed(reason, message string)

func (*Experiment) MarkExperimentStatusRestarting

func (exp *Experiment) MarkExperimentStatusRestarting(reason, message string)

func (*Experiment) MarkExperimentStatusRunning

func (exp *Experiment) MarkExperimentStatusRunning(reason, message string)

func (*Experiment) MarkExperimentStatusSucceeded

func (exp *Experiment) MarkExperimentStatusSucceeded(reason, message string)

func (*Experiment) SetDefault

func (e *Experiment) SetDefault()

type ExperimentCondition

type ExperimentCondition struct {
	// Type of experiment condition.
	Type ExperimentConditionType `json:"type"`

	// Status of the condition, one of True, False, Unknown.
	Status v1.ConditionStatus `json:"status"`

	// The reason for the condition's last transition.
	Reason string `json:"reason,omitempty"`

	// A human readable message indicating details about the transition.
	Message string `json:"message,omitempty"`

	// The last time this condition was updated.
	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`

	// Last time the condition transitioned from one status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

ExperimentCondition describes the state of the experiment at a certain point. +k8s:deepcopy-gen=true

func (*ExperimentCondition) DeepCopy

func (in *ExperimentCondition) DeepCopy() *ExperimentCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentCondition.

func (*ExperimentCondition) DeepCopyInto

func (in *ExperimentCondition) DeepCopyInto(out *ExperimentCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExperimentConditionType

type ExperimentConditionType string

ExperimentConditionType defines the state of an Experiment.

const (
	ExperimentCreated    ExperimentConditionType = "Created"
	ExperimentRunning    ExperimentConditionType = "Running"
	ExperimentRestarting ExperimentConditionType = "Restarting"
	ExperimentSucceeded  ExperimentConditionType = "Succeeded"
	ExperimentFailed     ExperimentConditionType = "Failed"
)

type ExperimentList

type ExperimentList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Experiment `json:"items"`
}

ExperimentList contains a list of Experiments

func (*ExperimentList) DeepCopy

func (in *ExperimentList) DeepCopy() *ExperimentList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentList.

func (*ExperimentList) DeepCopyInto

func (in *ExperimentList) DeepCopyInto(out *ExperimentList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ExperimentList) DeepCopyObject

func (in *ExperimentList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ExperimentSpec

type ExperimentSpec struct {
	// List of hyperparameter configurations.
	Parameters []ParameterSpec `json:"parameters,omitempty"`

	// Describes the objective of the experiment.
	Objective *common.ObjectiveSpec `json:"objective,omitempty"`

	// Describes the suggestion algorithm.
	Algorithm *common.AlgorithmSpec `json:"algorithm,omitempty"`

	// Describes the early stopping algorithm.
	EarlyStopping *common.EarlyStoppingSpec `json:"earlyStopping,omitempty"`

	// Template for each run of the trial.
	TrialTemplate *TrialTemplate `json:"trialTemplate,omitempty"`

	// How many trials can be processed in parallel.
	// Defaults to 3
	ParallelTrialCount *int32 `json:"parallelTrialCount,omitempty"`

	// Max completed trials to mark experiment as succeeded
	MaxTrialCount *int32 `json:"maxTrialCount,omitempty"`

	// Max failed trials to mark experiment as failed.
	MaxFailedTrialCount *int32 `json:"maxFailedTrialCount,omitempty"`

	// Describes the specification of the metrics collector
	MetricsCollectorSpec *common.MetricsCollectorSpec `json:"metricsCollectorSpec,omitempty"`

	NasConfig *NasConfig `json:"nasConfig,omitempty"`

	// Describes resuming policy which usually take effect after experiment terminated.
	ResumePolicy ResumePolicyType `json:"resumePolicy,omitempty"`
}

ExperimentSpec is the specification of an Experiment.

func (*ExperimentSpec) DeepCopy

func (in *ExperimentSpec) DeepCopy() *ExperimentSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentSpec.

func (*ExperimentSpec) DeepCopyInto

func (in *ExperimentSpec) DeepCopyInto(out *ExperimentSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExperimentStatus

type ExperimentStatus struct {
	// Represents time when the Experiment was acknowledged by the Experiment controller.
	// It is not guaranteed to be set in happens-before order across separate operations.
	// It is represented in RFC3339 form and is in UTC.
	StartTime *metav1.Time `json:"startTime,omitempty"`

	// Represents time when the Experiment was completed. It is not guaranteed to
	// be set in happens-before order across separate operations.
	// It is represented in RFC3339 form and is in UTC.
	CompletionTime *metav1.Time `json:"completionTime,omitempty"`

	// Represents last time when the Experiment was reconciled. It is not guaranteed to
	// be set in happens-before order across separate operations.
	// It is represented in RFC3339 form and is in UTC.
	LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"`

	// List of observed runtime conditions for this Experiment.
	Conditions []ExperimentCondition `json:"conditions,omitempty"`

	// Current optimal trial parameters and observations.
	CurrentOptimalTrial OptimalTrial `json:"currentOptimalTrial,omitempty"`

	// List of trial names which are running.
	RunningTrialList []string `json:"runningTrialList,omitempty"`

	// List of trial names which are pending.
	PendingTrialList []string `json:"pendingTrialList,omitempty"`

	// List of trial names which have already failed.
	FailedTrialList []string `json:"failedTrialList,omitempty"`

	// List of trial names which have already succeeded.
	SucceededTrialList []string `json:"succeededTrialList,omitempty"`

	// List of trial names which have been killed.
	KilledTrialList []string `json:"killedTrialList,omitempty"`

	// List of trial names which have been early stopped.
	EarlyStoppedTrialList []string `json:"earlyStoppedTrialList,omitempty"`

	// Trials is the total number of trials owned by the experiment.
	Trials int32 `json:"trials,omitempty"`

	// How many trials have succeeded.
	TrialsSucceeded int32 `json:"trialsSucceeded,omitempty"`

	// How many trials have failed.
	TrialsFailed int32 `json:"trialsFailed,omitempty"`

	// How many trials have been killed.
	TrialsKilled int32 `json:"trialsKilled,omitempty"`

	// How many trials are currently pending.
	TrialsPending int32 `json:"trialsPending,omitempty"`

	// How many trials are currently running.
	TrialsRunning int32 `json:"trialsRunning,omitempty"`

	// How many trials are currently early stopped.
	TrialsEarlyStopped int32 `json:"trialsEarlyStopped,omitempty"`
}

ExperimentStatus is the current status of an Experiment.

func (*ExperimentStatus) DeepCopy

func (in *ExperimentStatus) DeepCopy() *ExperimentStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentStatus.

func (*ExperimentStatus) DeepCopyInto

func (in *ExperimentStatus) DeepCopyInto(out *ExperimentStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FeasibleSpace

type FeasibleSpace struct {
	Max  string   `json:"max,omitempty"`
	Min  string   `json:"min,omitempty"`
	List []string `json:"list,omitempty"`
	Step string   `json:"step,omitempty"`
}

func (*FeasibleSpace) DeepCopy

func (in *FeasibleSpace) DeepCopy() *FeasibleSpace

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FeasibleSpace.

func (*FeasibleSpace) DeepCopyInto

func (in *FeasibleSpace) DeepCopyInto(out *FeasibleSpace)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GraphConfig

type GraphConfig struct {
	NumLayers   *int32  `json:"numLayers,omitempty"`
	InputSizes  []int32 `json:"inputSizes,omitempty"`
	OutputSizes []int32 `json:"outputSizes,omitempty"`
}

GraphConfig contains a config of DAG

func (*GraphConfig) DeepCopy

func (in *GraphConfig) DeepCopy() *GraphConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GraphConfig.

func (*GraphConfig) DeepCopyInto

func (in *GraphConfig) DeepCopyInto(out *GraphConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NasConfig

type NasConfig struct {
	GraphConfig GraphConfig `json:"graphConfig,omitempty"`
	Operations  []Operation `json:"operations,omitempty"`
}

NasConfig contains config for NAS job

func (*NasConfig) DeepCopy

func (in *NasConfig) DeepCopy() *NasConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NasConfig.

func (*NasConfig) DeepCopyInto

func (in *NasConfig) DeepCopyInto(out *NasConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Operation

type Operation struct {
	OperationType string          `json:"operationType,omitempty"`
	Parameters    []ParameterSpec `json:"parameters,omitempty"`
}

Operation contains type of operation in DAG

func (*Operation) DeepCopy

func (in *Operation) DeepCopy() *Operation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Operation.

func (*Operation) DeepCopyInto

func (in *Operation) DeepCopyInto(out *Operation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OptimalTrial

type OptimalTrial struct {
	// BestTrialName is the name of the best trial.
	BestTrialName string `json:"bestTrialName"`
	// Key-value pairs for hyperparameters and assignment values.
	ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments"`

	// Observation for this trial
	Observation common.Observation `json:"observation,omitempty"`
}

OptimalTrial is the metrics and assignments of the best trial.

func (*OptimalTrial) DeepCopy

func (in *OptimalTrial) DeepCopy() *OptimalTrial

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptimalTrial.

func (*OptimalTrial) DeepCopyInto

func (in *OptimalTrial) DeepCopyInto(out *OptimalTrial)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ParameterSpec

type ParameterSpec struct {
	Name          string        `json:"name,omitempty"`
	ParameterType ParameterType `json:"parameterType,omitempty"`
	FeasibleSpace FeasibleSpace `json:"feasibleSpace,omitempty"`
}

func (*ParameterSpec) DeepCopy

func (in *ParameterSpec) DeepCopy() *ParameterSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParameterSpec.

func (*ParameterSpec) DeepCopyInto

func (in *ParameterSpec) DeepCopyInto(out *ParameterSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ParameterType

type ParameterType string
const (
	ParameterTypeUnknown     ParameterType = "unknown"
	ParameterTypeDouble      ParameterType = "double"
	ParameterTypeInt         ParameterType = "int"
	ParameterTypeDiscrete    ParameterType = "discrete"
	ParameterTypeCategorical ParameterType = "categorical"
)

type ResumePolicyType

type ResumePolicyType string

ResumePolicyType describes how the experiment should be resumed. Only one of the following resume policies may be specified. If none of the following policies is specified, the default one is LongRunning.

const (
	// NeverResume indicates that experiment can't be resumed.
	NeverResume ResumePolicyType = "Never"
	// LongRunning indicates that experiment's suggestion resources
	// (deployment and service) are always running.
	LongRunning ResumePolicyType = "LongRunning"
	// FromVolume indicates that volume is attached to experiment's
	// suggestion. Suggestion data can be retained in the volume.
	// When experiment is succeeded suggestion deployment and service are deleted.
	FromVolume ResumePolicyType = "FromVolume"
)

type TrialParameterSpec

type TrialParameterSpec struct {
	// Name of the parameter that must be replaced in trial template
	Name string `json:"name,omitempty"`

	// Description of the parameter
	Description string `json:"description,omitempty"`

	// Reference to the parameter in search space
	Reference string `json:"reference,omitempty"`
}

TrialParameterSpec describes parameters that must be replaced in trial template

func (*TrialParameterSpec) DeepCopy

func (in *TrialParameterSpec) DeepCopy() *TrialParameterSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialParameterSpec.

func (*TrialParameterSpec) DeepCopyInto

func (in *TrialParameterSpec) DeepCopyInto(out *TrialParameterSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialSource

type TrialSource struct {

	// TrialSpec represents trial template in unstructured format
	TrialSpec *unstructured.Unstructured `json:"trialSpec,omitempty"`

	// ConfigMap spec represents a reference to ConfigMap
	ConfigMap *ConfigMapSource `json:"configMap,omitempty"`
}

TrialSource represent the source for trial template Only one source can be specified

func (*TrialSource) DeepCopy

func (in *TrialSource) DeepCopy() *TrialSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialSource.

func (*TrialSource) DeepCopyInto

func (in *TrialSource) DeepCopyInto(out *TrialSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialTemplate

type TrialTemplate struct {
	// Retain indicates that trial resources must be not cleanup
	Retain bool `json:"retain,omitempty"`

	// Source for trial template (unstructured structure or config map)
	TrialSource `json:",inline"`

	// List of parameters that are used in trial template
	TrialParameters []TrialParameterSpec `json:"trialParameters,omitempty"`

	// Labels that determines if pod needs to be injected by Katib sidecar container.
	// If PrimaryPodLabels is omitted, metrics collector wraps all Trial's pods.
	PrimaryPodLabels map[string]string `json:"primaryPodLabels,omitempty"`

	// Name of training container where actual model training is running
	PrimaryContainerName string `json:"primaryContainerName,omitempty"`

	// Condition when trial custom resource is succeeded.
	// Condition must be in GJSON format, ref https://github.com/tidwall/gjson.
	// For example for BatchJob: status.conditions.#(type=="Complete")#|#(status=="True")#
	SuccessCondition string `json:"successCondition,omitempty"`

	// Condition when trial custom resource is failed.
	// Condition must be in GJSON format, ref https://github.com/tidwall/gjson.
	// For example for BatchJob: status.conditions.#(type=="Failed")#|#(status=="True")#
	FailureCondition string `json:"failureCondition,omitempty"`
}

TrialTemplate describes structure of trial template

func (*TrialTemplate) DeepCopy

func (in *TrialTemplate) DeepCopy() *TrialTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialTemplate.

func (*TrialTemplate) DeepCopyInto

func (in *TrialTemplate) DeepCopyInto(out *TrialTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.