Skip to content

Commit

Permalink
minor import renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
johnugeorge committed May 14, 2019
1 parent ce1242a commit d37e8e3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/controller/v1alpha2/experiment/util/webhook_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"

commonapi "github.com/kubeflow/katib/pkg/api/operators/apis/common/v1alpha2"
ep_v1alpha2 "github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2"
commonapiv1alpha2 "github.com/kubeflow/katib/pkg/api/operators/apis/common/v1alpha2"
experimentsv1alpha2 "github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2"
commonv1alpha2 "github.com/kubeflow/katib/pkg/common/v1alpha2"
)

func ValidateExperiment(instance *ep_v1alpha2.Experiment) error {
func ValidateExperiment(instance *experimentsv1alpha2.Experiment) error {
if !instance.IsCreated() {
if err := validateForCreate(instance); err != nil {
return err
Expand Down Expand Up @@ -67,25 +67,25 @@ func ValidateExperiment(instance *ep_v1alpha2.Experiment) error {
return nil
}

func validateAlgorithmSettings(inst *ep_v1alpha2.Experiment) error {
func validateAlgorithmSettings(inst *experimentsv1alpha2.Experiment) error {
// TODO: it need call ValidateAlgorithmSettings API of vizier-core manager, implement it when vizier-core done
return nil
}

func validateObjective(obj *commonapi.ObjectiveSpec) error {
func validateObjective(obj *commonapiv1alpha2.ObjectiveSpec) error {
if obj == nil {
return fmt.Errorf("No spec.objective specified.")
}
if obj.Type != commonapi.ObjectiveTypeMinimize && obj.Type != commonapi.ObjectiveTypeMaximize {
return fmt.Errorf("spec.objective.type must be %s or %s.", commonapi.ObjectiveTypeMinimize, commonapi.ObjectiveTypeMaximize)
if obj.Type != commonapiv1alpha2.ObjectiveTypeMinimize && obj.Type != commonapiv1alpha2.ObjectiveTypeMaximize {
return fmt.Errorf("spec.objective.type must be %s or %s.", commonapiv1alpha2.ObjectiveTypeMinimize, commonapiv1alpha2.ObjectiveTypeMaximize)
}
if obj.ObjectiveMetricName == "" {
return fmt.Errorf("No spec.objective.objectiveMetricName specified.")
}
return nil
}

func validateAlgorithm(ag *ep_v1alpha2.AlgorithmSpec) error {
func validateAlgorithm(ag *experimentsv1alpha2.AlgorithmSpec) error {
if ag == nil {
return fmt.Errorf("No spec.algorithm specified.")
}
Expand All @@ -96,7 +96,7 @@ func validateAlgorithm(ag *ep_v1alpha2.AlgorithmSpec) error {
return nil
}

func validateTrialTemplate(instance *ep_v1alpha2.Experiment) error {
func validateTrialTemplate(instance *experimentsv1alpha2.Experiment) error {
trialName := fmt.Sprintf("%s-trial", instance.GetName())
trialParams := TrialTemplateParams{
Experiment: instance.GetName(),
Expand Down Expand Up @@ -140,7 +140,7 @@ func validateSupportedJob(job *unstructured.Unstructured) error {
return fmt.Errorf("Job type %v not supported", gvk)
}

func validateForCreate(inst *ep_v1alpha2.Experiment) error {
func validateForCreate(inst *experimentsv1alpha2.Experiment) error {
if _, err := GetExperimentFromDB(inst); err != nil {
if err != sql.ErrNoRows {
return fmt.Errorf("Fail to check record for the experiment in DB: %v", err)
Expand All @@ -151,7 +151,7 @@ func validateForCreate(inst *ep_v1alpha2.Experiment) error {
}
}

func validateMetricsCollector(inst *ep_v1alpha2.Experiment) error {
func validateMetricsCollector(inst *experimentsv1alpha2.Experiment) error {
BUFSIZE := 1024
experimentName := inst.GetName()
trialName := fmt.Sprintf("%s-trial", inst.GetName())
Expand Down

0 comments on commit d37e8e3

Please sign in to comment.