Skip to content

Commit

Permalink
[UI] Fix Trial Logs when Kubernetes Job Fails
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvelich committed Jun 19, 2023
1 parent 37b237f commit bb16872
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/new-ui/v1beta1/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,15 @@ func fetchMasterPodName(clientset *kubernetes.Clientset, trial *trialsv1beta1.Tr
field to "true" in the Experiment definition. If this error persists then the Pod's logs are not currently
persisted in the cluster.`)
}
if len(podList.Items) > 1 {
return "", errors.New("More than one master replica found")

// If Pod is Running or Succeeded Pod, return it.
for _, pod := range podList.Items {
if pod.Status.Phase == corev1.PodSucceeded || pod.Status.Phase == corev1.PodRunning {
return pod.Name, nil
}
}

// Otherwise, return the first Failed Pod.
return podList.Items[0].Name, nil
}

Expand Down

0 comments on commit bb16872

Please sign in to comment.