Skip to content

Commit

Permalink
added a better conditional for updating the resize if the job is a Ra…
Browse files Browse the repository at this point in the history
…yCluster
  • Loading branch information
vicentefb committed Mar 15, 2024
1 parent 42b492c commit 25584c9
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions pkg/controller/jobframework/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,18 @@ func (r *JobReconciler) ReconcileGenericJob(ctx context.Context, req ctrl.Reques
}

// 4.1 update podSetCount for RayCluster resize
if features.Enabled(features.DynamicallySizedJobs) && wl != nil && workload.IsAdmitted(wl) {
if features.Enabled(features.DynamicallySizedJobs) && wl != nil && workload.IsAdmitted(wl) && job.GVK().Kind == "RayCluster" {
podSets := job.PodSets()
if len(podSets) == 2 {
jobPodSetCount := podSets[1].Count
workloadPodSetCount := wl.Spec.PodSets[1].Count
if workloadPodSetCount != jobPodSetCount {
toUpdate := wl
_, err := r.updateWorkloadToMatchJob(ctx, job, object, toUpdate, "Updated Workload due to resize: %v")
if err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{}, nil
jobPodSetCount := podSets[1].Count
workloadPodSetCount := wl.Spec.PodSets[1].Count
if workloadPodSetCount != jobPodSetCount {
toUpdate := wl
_, err := r.updateWorkloadToMatchJob(ctx, job, object, toUpdate, "Updated Workload due to resize: %v")
if err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{}, nil
}

}

// 5. handle WaitForPodsReady only for a standalone job.
Expand Down

0 comments on commit 25584c9

Please sign in to comment.