diff --git a/pkg/controller.v1alpha3/experiment/experiment_controller.go b/pkg/controller.v1alpha3/experiment/experiment_controller.go index d169169e5e5..0bea27e3835 100644 --- a/pkg/controller.v1alpha3/experiment/experiment_controller.go +++ b/pkg/controller.v1alpha3/experiment/experiment_controller.go @@ -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{} @@ -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()}) @@ -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 @@ -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 diff --git a/pkg/controller.v1alpha3/trial/trial_controller_util.go b/pkg/controller.v1alpha3/trial/trial_controller_util.go index f2d5faae595..3bae4e91622 100644 --- a/pkg/controller.v1alpha3/trial/trial_controller_util.go +++ b/pkg/controller.v1alpha3/trial/trial_controller_util.go @@ -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