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: Use 64 instead of 32 since we are using float64 #883

Merged
merged 1 commit into from
Oct 15, 2019
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
10 changes: 10 additions & 0 deletions pkg/controller.v1alpha3/experiment/experiment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ func (r *ReconcileExperiment) Reconcile(request reconcile.Request) (reconcile.Re
return reconcile.Result{}, nil
}

// ReconcileExperiment is the main reconcile loop.
func (r *ReconcileExperiment) ReconcileExperiment(instance *experimentsv1alpha3.Experiment) error {
logger := log.WithValues("Experiment", types.NamespacedName{Name: instance.GetName(), Namespace: instance.GetNamespace()})
trials := &trialsv1alpha3.TrialList{}
Expand All @@ -246,6 +247,7 @@ func (r *ReconcileExperiment) ReconcileExperiment(instance *experimentsv1alpha3.
return nil
}

// ReconcileTrials syncs trials.
func (r *ReconcileExperiment) ReconcileTrials(instance *experimentsv1alpha3.Experiment, trials []trialsv1alpha3.Trial) error {

logger := log.WithValues("Experiment", types.NamespacedName{Name: instance.GetName(), Namespace: instance.GetNamespace()})
Expand Down Expand Up @@ -283,6 +285,13 @@ func (r *ReconcileExperiment) ReconcileTrials(instance *experimentsv1alpha3.Expe
addCount = 0
}

logger.Info("Statistics",
"requiredActiveCount", requiredActiveCount,
"parallelCount", parallelCount,
"activeCount", activeCount,
"completedCount", completedCount,
)

//skip if no trials need to be created
if addCount > 0 {
//create "addCount" number of trials
Expand Down Expand Up @@ -336,6 +345,7 @@ func (r *ReconcileExperiment) deleteTrials(instance *experimentsv1alpha3.Experim
return nil
}

// ReconcileSuggestions gets or creates the suggestion if needed.
func (r *ReconcileExperiment) ReconcileSuggestions(instance *experimentsv1alpha3.Experiment, currentCount, addCount int32) ([]suggestionsv1alpha3.TrialAssignment, error) {
logger := log.WithValues("Experiment", types.NamespacedName{Name: instance.GetName(), Namespace: instance.GetNamespace()})
var assignments []suggestionsv1alpha3.TrialAssignment
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller.v1alpha3/trial/trial_controller_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ func getBestObjectiveMetricValue(metricLogs []*api_pb.MetricLog, objectiveType c
return nil
}

bestObjectiveValue, _ := strconv.ParseFloat(metricLogs[0].Metric.Value, 32)
bestObjectiveValue, _ := strconv.ParseFloat(metricLogs[0].Metric.Value, 64)
for _, metricLog := range metricLogs[1:] {
objectiveMetricValue, _ := strconv.ParseFloat(metricLog.Metric.Value, 32)
objectiveMetricValue, _ := strconv.ParseFloat(metricLog.Metric.Value, 64)
if objectiveType == commonv1alpha3.ObjectiveTypeMinimize {
if objectiveMetricValue < bestObjectiveValue {
bestObjectiveValue = objectiveMetricValue
Expand Down