Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
Add the logic to check PodGroup changes
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y committed Jan 19, 2023
1 parent f4c7043 commit 65bcf75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controller.v1/common/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"github.com/google/go-cmp/cmp"

apiv1 "github.com/kubeflow/common/pkg/apis/common/v1"

Expand All @@ -41,10 +42,14 @@ func (jc *JobController) SyncPodGroup(job metav1.Object, specFunc FillPodGroupSp
podGroup, err := pgctl.GetPodGroup(job.GetNamespace(), job.GetName())
if err == nil {
// update podGroup for gang scheduling
oldPodGroup := podGroup
if err = specFunc(podGroup); err != nil {
return nil, fmt.Errorf("unable to fill the spec of PodGroup, '%v': %v", klog.KObj(podGroup), err)
}
return nil, pgctl.UpdatePodGroup(podGroup.(client.Object))
if diff := cmp.Diff(oldPodGroup, podGroup); len(diff) != 0 {
return podGroup, pgctl.UpdatePodGroup(podGroup.(client.Object))
}
return podGroup, nil
} else if client.IgnoreNotFound(err) != nil {
return nil, fmt.Errorf("unable to get a PodGroup: %v", err)
} else {
Expand Down

0 comments on commit 65bcf75

Please sign in to comment.