Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): resolve all api voilation exceptions in katib api #2482

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions hack/violation_exception_v1beta1.list
Original file line number Diff line number Diff line change
@@ -1,30 +0,0 @@
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,AlgorithmSpec,AlgorithmSettings
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,EarlyStoppingSpec,AlgorithmSettings
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,FilterSpec,MetricsFormat
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,ObjectiveSpec,AdditionalMetricNames
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,ObjectiveSpec,MetricStrategies
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1,Observation,Metrics
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentSpec,Parameters
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,Conditions
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,EarlyStoppedTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,FailedTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,KilledTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,MetricsUnavailableTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,PendingTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,RunningTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,ExperimentStatus,SucceededTrialList
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,FeasibleSpace,List
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,GraphConfig,InputSizes
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,GraphConfig,OutputSizes
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,NasConfig,Operations
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,Operation,Parameters
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,OptimalTrial,ParameterAssignments
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1,TrialTemplate,TrialParameters
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1,SuggestionStatus,AlgorithmSettings
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1,SuggestionStatus,Conditions
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1,SuggestionStatus,Suggestions
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1,TrialAssignment,EarlyStoppingRules
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1,TrialAssignment,ParameterAssignments
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1,TrialSpec,EarlyStoppingRules
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1,TrialSpec,ParameterAssignments
API rule violation: list_type_missing,github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1,TrialStatus,Conditions
10 changes: 10 additions & 0 deletions pkg/apis/controller/common/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type AlgorithmSpec struct {
AlgorithmName string `json:"algorithmName,omitempty"`

// Key-value pairs representing settings for suggestion algorithms.
// +listType=map
// +listMapKey=name
AlgorithmSettings []AlgorithmSetting `json:"algorithmSettings,omitempty"`
}

Expand All @@ -46,6 +48,8 @@ type EarlyStoppingSpec struct {
AlgorithmName string `json:"algorithmName,omitempty"`

// Key-value pairs representing settings for early stopping algorithm.
// +listType=map
// +listMapKey=name
AlgorithmSettings []EarlyStoppingSetting `json:"algorithmSettings,omitempty"`
}

Expand Down Expand Up @@ -105,10 +109,13 @@ type ObjectiveSpec struct {
// AdditionalMetricNames represents metrics that should be collected from Trials.
// This can be empty if we only care about the objective metric.
// Note: If we adopt a push instead of pull mechanism, this can be omitted completely.
// +listType=set
AdditionalMetricNames []string `json:"additionalMetricNames,omitempty"`

// MetricStrategies defines various rules (min, max or latest) to extract metrics values.
// This field is allowed to missing, experiment defaulter (webhook) will fill it.
// +listType=map
// +listMapKey=name
MetricStrategies []MetricStrategy `json:"metricStrategies,omitempty"`
}

Expand Down Expand Up @@ -150,6 +157,8 @@ type Metric struct {
// +k8s:deepcopy-gen=true
type Observation struct {
// Key-value pairs for metric names and values
// +listType=map
// +listMapKey=name
Metrics []Metric `json:"metrics,omitempty"`
}

Expand Down Expand Up @@ -177,6 +186,7 @@ type SourceSpec struct {
type FilterSpec struct {
// When the metrics output follows format as this field specified, metricsCollector
// collects it and reports to metrics server, it can be "<metric_name>: <float>" or else
// +listType=set
MetricsFormat []string `json:"metricsFormat,omitempty"`
}

Expand Down
41 changes: 34 additions & 7 deletions pkg/apis/controller/experiments/v1beta1/experiment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
// ExperimentSpec is the specification of an Experiment.
type ExperimentSpec struct {
// List of hyperparameter configurations.
// +listType=map
// +listMapKey=name
Parameters []ParameterSpec `json:"parameters,omitempty"`

// Describes the objective of the experiment.
Expand Down Expand Up @@ -78,30 +80,39 @@ type ExperimentStatus struct {
LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"`

// List of observed runtime conditions for this Experiment.
// +listType=map
// +listMapKey=type
Conditions []ExperimentCondition `json:"conditions,omitempty"`

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

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

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

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

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

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

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

// List of trial names which have been metrics unavailable
// +listType=set
MetricsUnavailableTrialList []string `json:"metricsUnavailableTrialList,omitempty"`

// Trials is the total number of trials owned by the experiment.
Expand Down Expand Up @@ -134,6 +145,8 @@ type OptimalTrial struct {
// BestTrialName is the name of the best trial.
BestTrialName string `json:"bestTrialName,omitempty"`
// Key-value pairs for hyperparameters and assignment values.
// +listType=map
// +listMapKey=name
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments,omitempty"`

// Observation for this trial
Expand Down Expand Up @@ -207,8 +220,10 @@ const (
)

type FeasibleSpace struct {
Max string `json:"max,omitempty"`
Min string `json:"min,omitempty"`
Max string `json:"max,omitempty"`
Min string `json:"min,omitempty"`

// +listType=set
List []string `json:"list,omitempty"`
Step string `json:"step,omitempty"`
Distribution Distribution `json:"distribution,omitempty"`
Expand All @@ -233,6 +248,8 @@ type TrialTemplate struct {
TrialSource `json:",inline"`

// List of parameters that are used in trial template
// +listType=map
// +listMapKey=name
TrialParameters []TrialParameterSpec `json:"trialParameters,omitempty"`

// Labels that determines if pod needs to be injected by Katib sidecar container.
Expand Down Expand Up @@ -314,20 +331,30 @@ type ExperimentList struct {
// NasConfig contains config for NAS job
type NasConfig struct {
GraphConfig GraphConfig `json:"graphConfig,omitempty"`
Operations []Operation `json:"operations,omitempty"`

// +listType=map
// +listMapKey=operationType
Operations []Operation `json:"operations,omitempty"`
}

// GraphConfig contains a config of DAG
type GraphConfig struct {
NumLayers *int32 `json:"numLayers,omitempty"`
InputSizes []int32 `json:"inputSizes,omitempty"`
NumLayers *int32 `json:"numLayers,omitempty"`

// +listType=set
InputSizes []int32 `json:"inputSizes,omitempty"`

// +listType=set
OutputSizes []int32 `json:"outputSizes,omitempty"`
}

// Operation contains type of operation in DAG
type Operation struct {
OperationType string `json:"operationType,omitempty"`
Parameters []ParameterSpec `json:"parameters,omitempty"`
OperationType string `json:"operationType,omitempty"`

// +listType=map
// +listMapKey=name
Parameters []ParameterSpec `json:"parameters,omitempty"`
}

func init() {
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/controller/suggestions/v1beta1/suggestion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ type SuggestionStatus struct {
// AlgorithmSettings defines HP or NAS algorithm settings which suggestion gRPC service returns.
// These settings overwrites Experiment's settings before the gRPC request.
// It can be empty if settings haven't been changed.
// +listType=map
// +listMapKey=name
AlgorithmSettings []common.AlgorithmSetting `json:"algorithmSettings,omitempty"`

// Number of suggestion results
SuggestionCount int32 `json:"suggestionCount,omitempty"`

// Suggestion results
// +listType=map
// +listMapKey=name
Suggestions []TrialAssignment `json:"suggestions,omitempty"`

// Represents time when the Suggestion was acknowledged by the Suggestion controller.
Expand All @@ -70,19 +74,25 @@ type SuggestionStatus struct {
LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"`

// List of observed runtime conditions for this Suggestion.
// +listType=map
// +listMapKey=type
Conditions []SuggestionCondition `json:"conditions,omitempty"`
}

// TrialAssignment is the assignment for one trial.
type TrialAssignment struct {
// Suggestion results with Trial parameters
// +listType=map
// +listMapKey=name
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments,omitempty"`

// Name of the suggestion
Name string `json:"name,omitempty"`

// Rules for early stopping techniques
// Contains rule name, value and comparison type
// +listType=map
// +listMapKey=name
EarlyStoppingRules []common.EarlyStoppingRule `json:"earlyStoppingRules,omitempty"`

// Suggestion label metadata to attach to Trial job
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/controller/trials/v1beta1/trial_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ type TrialSpec struct {
Objective *common.ObjectiveSpec `json:"objective,omitempty"`

// Key-value pairs for hyperparameters and assignment values.
// +listType=map
// +listMapKey=name
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments,omitempty"`

// Rules for early stopping techniques.
// Each rule should be met to early stop Trial.
// +listType=map
// +listMapKey=name
EarlyStoppingRules []common.EarlyStoppingRule `json:"earlyStoppingRules,omitempty"`

// Raw text for the trial run spec. This can be any generic Kubernetes
Expand Down Expand Up @@ -84,6 +88,8 @@ type TrialStatus struct {
LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"`

// List of observed runtime conditions for this Trial.
// +listType=map
// +listMapKey=type
Conditions []TrialCondition `json:"conditions,omitempty"`

// Results of the Trial - objectives and other metrics values.
Expand Down
Loading