Skip to content

Commit

Permalink
Merge pull request #3117 from Lily922/release-1.8
Browse files Browse the repository at this point in the history
[cherry-pick for release-1.8]successfully scheduled events will not be reported repeatedly for podGroup resource
  • Loading branch information
volcano-sh-bot authored Sep 13, 2023
2 parents dd579a8 + 7d6e8ea commit c8f13bb
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 c8f13bb

Please sign in to comment.