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

Checked pod group unschedulable event. #443

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/scheduler/framework/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ func (ssn *Session) Preemptable(preemptor *api.TaskInfo, preemptees []*api.TaskI
return victims
}

// Discard discards a job from session, so no plugin/action handles it.
func (ssn *Session) Discard(job *api.JobInfo, event arbcorev1.Event, reason string) error {
// Backoff discards a job from session, so no plugin/action handles it.
func (ssn *Session) Backoff(job *api.JobInfo, event arbcorev1.Event, reason string) error {
if err := ssn.cache.Backoff(job, event, reason); err != nil {
glog.Errorf("Failed to backoff job <%s/%s>: %v",
job.Namespace, job.Name, err)
Expand Down
8 changes: 6 additions & 2 deletions pkg/scheduler/plugins/gang/gang.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func jobReady(obj interface{}) bool {
func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) {
for _, job := range ssn.Jobs {
if validTaskNum(job) < job.MinAvailable {
ssn.Discard(job, arbcorev1.UnschedulableEvent, "not enough valid tasks for gang-scheduling")
ssn.Backoff(job, arbcorev1.UnschedulableEvent, "not enough valid tasks for gang-scheduling")
}
}

Expand Down Expand Up @@ -139,5 +139,9 @@ func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) {
}

func (gp *gangPlugin) OnSessionClose(ssn *framework.Session) {

for _, job := range ssn.Jobs {
if len(job.TaskStatusIndex[api.Allocated]) != 0 {
ssn.Backoff(job, arbcorev1.UnschedulableEvent, "not enough resource for job")
}
}
}
3 changes: 3 additions & 0 deletions test/e2e/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ var _ = Describe("Job E2E Test", func() {
err = waitPodGroupPending(context, pg)
Expect(err).NotTo(HaveOccurred())

waitPodGroupUnschedulable(context, pg)
Expect(err).NotTo(HaveOccurred())

err = deleteReplicaSet(context, replicaset.Name)
Expect(err).NotTo(HaveOccurred())

Expand Down