Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6d30f84

Browse files
johnugeorgek8s-ci-robot
authored andcommittedJun 3, 2019
Check pending status for pastBackoffLimitOnFailure (#171)
1 parent 5bc7c08 commit 6d30f84

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed
 

‎pkg/controller.v1/pytorch/controller.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,15 @@ func (pc *PyTorchController) pastBackoffLimit(job *pyv1.PyTorchJob, pods []*v1.P
512512
}
513513
for i := range pods {
514514
po := pods[i]
515-
if po.Status.Phase != v1.PodRunning {
516-
continue
517-
}
518-
for j := range po.Status.InitContainerStatuses {
519-
stat := po.Status.InitContainerStatuses[j]
520-
result += stat.RestartCount
521-
}
522-
for j := range po.Status.ContainerStatuses {
523-
stat := po.Status.ContainerStatuses[j]
524-
result += stat.RestartCount
515+
if po.Status.Phase == v1.PodRunning || po.Status.Phase == v1.PodPending {
516+
for j := range po.Status.InitContainerStatuses {
517+
stat := po.Status.InitContainerStatuses[j]
518+
result += stat.RestartCount
519+
}
520+
for j := range po.Status.ContainerStatuses {
521+
stat := po.Status.ContainerStatuses[j]
522+
result += stat.RestartCount
523+
}
525524
}
526525
}
527526
}

‎pkg/controller.v1beta2/pytorch/controller.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,15 @@ func (pc *PyTorchController) pastBackoffLimit(job *v1beta2.PyTorchJob, pods []*v
512512
}
513513
for i := range pods {
514514
po := pods[i]
515-
if po.Status.Phase != v1.PodRunning {
516-
continue
517-
}
518-
for j := range po.Status.InitContainerStatuses {
519-
stat := po.Status.InitContainerStatuses[j]
520-
result += stat.RestartCount
521-
}
522-
for j := range po.Status.ContainerStatuses {
523-
stat := po.Status.ContainerStatuses[j]
524-
result += stat.RestartCount
515+
if po.Status.Phase == v1.PodRunning || po.Status.Phase == v1.PodPending {
516+
for j := range po.Status.InitContainerStatuses {
517+
stat := po.Status.InitContainerStatuses[j]
518+
result += stat.RestartCount
519+
}
520+
for j := range po.Status.ContainerStatuses {
521+
stat := po.Status.ContainerStatuses[j]
522+
result += stat.RestartCount
523+
}
525524
}
526525
}
527526
}

0 commit comments

Comments
 (0)
This repository has been archived.