Skip to content

Commit

Permalink
[cherry-pick for release-1.8]successfully scheduled events will not b…
Browse files Browse the repository at this point in the history
…e reported repeatedly for podGroup resource

Signed-off-by: lili <lili_9309@163.com>
  • Loading branch information
Lily922 committed Sep 13, 2023
1 parent dd579a8 commit 7d6e8ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ func (sc *SchedulerCache) String() string {
}

// RecordJobStatusEvent records related events according to job status.
func (sc *SchedulerCache) RecordJobStatusEvent(job *schedulingapi.JobInfo) {
func (sc *SchedulerCache) RecordJobStatusEvent(job *schedulingapi.JobInfo, updatePG bool) {
pgUnschedulable := job.PodGroup != nil &&
(job.PodGroup.Status.Phase == scheduling.PodGroupUnknown ||
job.PodGroup.Status.Phase == scheduling.PodGroupPending ||
Expand All @@ -1220,7 +1220,7 @@ func (sc *SchedulerCache) RecordJobStatusEvent(job *schedulingapi.JobInfo) {
len(job.Tasks),
job.FitError())
sc.recordPodGroupEvent(job.PodGroup, v1.EventTypeWarning, string(scheduling.PodGroupUnschedulableType), msg)
} else {
} else if updatePG {
sc.recordPodGroupEvent(job.PodGroup, v1.EventTypeNormal, string(scheduling.PodGroupScheduled), string(scheduling.PodGroupReady))
}

Expand Down Expand Up @@ -1253,7 +1253,7 @@ func (sc *SchedulerCache) UpdateJobStatus(job *schedulingapi.JobInfo, updatePG b
job.PodGroup = pg
}

sc.RecordJobStatusEvent(job)
sc.RecordJobStatusEvent(job, updatePG)

return job, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/cache/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Cache interface {

// RecordJobStatusEvent records related events according to job status.
// Deprecated: remove it after removed PDB support.
RecordJobStatusEvent(job *api.JobInfo)
RecordJobStatusEvent(job *api.JobInfo, updatePG bool)

// UpdateJobStatus puts job in backlog for a while.
UpdateJobStatus(job *api.JobInfo, updatePG bool) (*api.JobInfo, error)
Expand Down

0 comments on commit 7d6e8ea

Please sign in to comment.