Skip to content

Commit

Permalink
Remove unused field from Experiment Spec (kubeflow#806)
Browse files Browse the repository at this point in the history
* Remove unused field from Spec

* Remove references
  • Loading branch information
johnugeorge authored and k8s-ci-robot committed Sep 25, 2019
1 parent cc76656 commit d571094
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
3 changes: 0 additions & 3 deletions pkg/apis/controller/experiments/v1alpha3/experiment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ type ExperimentSpec struct {
// Max failed trials to mark experiment as failed.
MaxFailedTrialCount *int32 `json:"maxFailedTrialCount,omitempty"`

// Whether to retain historical data in DB after deletion.
RetainHistoricalData bool `json:"retainHistoricalData,omitempty"`

// For v1alpha3 we will keep the metrics collector implementation same as v1alpha1.
MetricsCollectorSpec *common.MetricsCollectorSpec `json:"metricsCollectorSpec,omitempty"`

Expand Down
30 changes: 0 additions & 30 deletions pkg/apis/controller/experiments/v1alpha3/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,33 +143,3 @@ func (exp *Experiment) MarkExperimentStatusFailed(reason, message string) {
}
exp.setCondition(ExperimentFailed, v1.ConditionTrue, reason, message)
}

func (exp *Experiment) NeedUpdateFinalizers() (bool, []string) {
deleted := !exp.ObjectMeta.DeletionTimestamp.IsZero()
pendingFinalizers := exp.GetFinalizers()
contained := false
for _, elem := range pendingFinalizers {
if elem == cleanDataFinalizer {
contained = true
break
}
}

if !deleted && !contained {
if exp.Spec.RetainHistoricalData {
return false, []string{}
}
finalizers := append(pendingFinalizers, cleanDataFinalizer)
return true, finalizers
}
if deleted && contained {
finalizers := []string{}
for _, pendingFinalizer := range pendingFinalizers {
if pendingFinalizer != cleanDataFinalizer {
finalizers = append(finalizers, pendingFinalizer)
}
}
return true, finalizers
}
return false, []string{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,8 @@ func newFakeInstance() *experimentsv1alpha3.Experiment {
Namespace: namespace,
},
Spec: experimentsv1alpha3.ExperimentSpec{
RetainHistoricalData: false,
ParallelTrialCount: &parallelCount,
MaxTrialCount: &parallelCount,
ParallelTrialCount: &parallelCount,
MaxTrialCount: &parallelCount,
Objective: &commonapiv1alpha3.ObjectiveSpec{
Type: commonapiv1alpha3.ObjectiveTypeMaximize,
Goal: &goal,
Expand Down

0 comments on commit d571094

Please sign in to comment.