Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve: Facilitate local development #6

Merged
merged 3 commits into from
Aug 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: Remove unneeded statements, unreachable code
brendangadd committed Aug 19, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 7d98d214fa61c43ef126a1ae6bc00064c1fb1746
41 changes: 20 additions & 21 deletions notebooks.go
Original file line number Diff line number Diff line change
@@ -115,40 +115,39 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) (Statu
// Return Container State if it's available
if notebook.Status.ContainerState.Running != nil {
return StatusRunning, "Running"
} else if notebook.Status.ContainerState.Terminated != nil {
}
if notebook.Status.ContainerState.Terminated != nil {
return StatusError, "The Pod has Terminated"
} else {
status, reason := StatusWarning, ""
}
status, reason := StatusWarning, ""

if notebook.Status.ContainerState.Waiting != nil {
status, reason = StatusWaiting, notebook.Status.ContainerState.Waiting.Reason
if notebook.Status.ContainerState.Waiting.Reason == "ImagePullBackoff" {
status, reason = StatusError, notebook.Status.ContainerState.Waiting.Reason
}
} else {
status, reason = StatusWaiting, "Scheduling the Pod"
if notebook.Status.ContainerState.Waiting != nil {
status, reason = StatusWaiting, notebook.Status.ContainerState.Waiting.Reason
if notebook.Status.ContainerState.Waiting.Reason == "ImagePullBackoff" {
status, reason = StatusError, notebook.Status.ContainerState.Waiting.Reason
}
} else {
status, reason = StatusWaiting, "Scheduling the Pod"
}

// Process events
for _, event := range events {
if event.Type == corev1.EventTypeWarning {
return StatusWarning, event.Message
}
// Process events
for _, event := range events {
if event.Type == corev1.EventTypeWarning {
return StatusWarning, event.Message
}

return status, reason
}

return "", ""
return status, reason

}

func processGPU(notebook *kubeflowv1.Notebook) (resource.Quantity, GPUVendor) {
if limit, ok := notebook.Spec.Template.Spec.Containers[0].Resources.Limits["nvidia.com/gpu"]; ok {
return limit, GPUVendorNvidia
} else if limit, ok := notebook.Spec.Template.Spec.Containers[0].Resources.Limits["amd.com/gpu"]; ok {
}
if limit, ok := notebook.Spec.Template.Spec.Containers[0].Resources.Limits["amd.com/gpu"]; ok {
return limit, GPUVendorAMD
}

return resource.Quantity{}, ""
}

@@ -316,7 +315,7 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
Spec: corev1.PodSpec{
ServiceAccountName: DefaultServiceAccountName,
Containers: []corev1.Container{
corev1.Container{
{
Name: req.Name,
Image: image,
Resources: corev1.ResourceRequirements{