Skip to content

Commit

Permalink
Fix trial info time (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvelich authored Feb 6, 2020
1 parent 99e7da8 commit 2f39fd6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/ui/v1alpha3/hp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 2f39fd6

Please sign in to comment.