From 17a0a6c7097a5651ca48e4780b206a38a922aa98 Mon Sep 17 00:00:00 2001 From: avelichk Date: Wed, 5 Feb 2020 13:20:57 +0300 Subject: [PATCH] Fix trial info time --- pkg/ui/v1alpha3/hp.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/ui/v1alpha3/hp.go b/pkg/ui/v1alpha3/hp.go index aa7ddd3385a..5eb68778545 100644 --- a/pkg/ui/v1alpha3/hp.go +++ b/pkg/ui/v1alpha3/hp.go @@ -162,13 +162,16 @@ func (k *KatibUIHandler) FetchHPJobTrialInfo(w http.ResponseWriter, r *http.Requ http.Error(w, err.Error(), http.StatusInternalServerError) return } - prevTime := "" + prevMetricTime := map[string]string{} for _, m := range obsLogResp.ObservationLog.MetricLogs { parsedTime, _ := time.Parse(time.RFC3339Nano, m.TimeStamp) formatTime := parsedTime.Format("2006-01-02T15:04:05") - if formatTime != prevTime { + if _, found := prevMetricTime[m.Metric.Name]; !found { + prevMetricTime[m.Metric.Name] = "" + } + if formatTime != prevMetricTime[m.Metric.Name] { resultText += m.Metric.Name + "," + formatTime + "," + m.Metric.Value + "\n" - prevTime = formatTime + prevMetricTime[m.Metric.Name] = formatTime } }