Skip to content

Commit

Permalink
Return error when Pod is in the Pending state
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvelich committed Jun 19, 2023
1 parent bb16872 commit 94cf6af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/new-ui/v1beta1/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,14 @@ func fetchMasterPodName(clientset *kubernetes.Clientset, trial *trialsv1beta1.Tr
}

// Otherwise, return the first Failed Pod.
return podList.Items[0].Name, nil
for _, pod := range podList.Items {
if pod.Status.Phase == corev1.PodFailed {
return pod.Name, nil
}
}

// Otherwise, return error since Pod is in the Pending state.
return "", errors.New("Failed to get logs for this Trial. Pod is in the Pending or Unknown state.")
}

// fetchPodLogs returns logs of a pod for the given job name and namespace
Expand Down

0 comments on commit 94cf6af

Please sign in to comment.