Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit 220c826

Browse files
authored
Merge pull request #100 from redskyops/fix/trial-job-status
Detect unschedulable trial job pods
2 parents da356ca + 3bfc9a1 commit 220c826

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

controllers/trial_job_controller.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,7 @@ func (r *TrialJobReconciler) applyJobStatus(ctx context.Context, t *redskyv1alph
179179
if matchingSelector, err := meta.MatchingSelector(job.Spec.Selector); err == nil {
180180
podList := &corev1.PodList{}
181181
if err := r.List(ctx, podList, client.InNamespace(job.Namespace), matchingSelector); err == nil {
182-
startedAt, finishedAt = containerTime(podList)
183-
184-
// Check if the job has a start/completion time, but it is not yet reflected in the pod state we are seeing
185-
if (startedAt == nil && job.Status.StartTime != nil) || (finishedAt == nil && job.Status.CompletionTime != nil) {
186-
return false, true
187-
}
188-
189-
// Look for pod failures (edge case where job controller doesn't update status properly, e.g. initContainer failure)
182+
// Look for pod failures (edge case where job controller doesn't update status properly, e.g. initContainer failure or unschedulable)
190183
for i := range podList.Items {
191184
s := &podList.Items[i].Status
192185
if s.Phase == corev1.PodFailed {
@@ -201,6 +194,12 @@ func (r *TrialJobReconciler) applyJobStatus(ctx context.Context, t *redskyv1alph
201194
}
202195
}
203196
}
197+
198+
// Check if the job has a start/completion time, but it is not yet reflected in the pod state we are seeing
199+
startedAt, finishedAt = containerTime(podList)
200+
if (startedAt == nil && job.Status.StartTime != nil) || (finishedAt == nil && job.Status.CompletionTime != nil) {
201+
return dirty, true
202+
}
204203
}
205204
}
206205

0 commit comments

Comments
 (0)