From ee24513e479735fc317c253cdd00bba4ef1101e2 Mon Sep 17 00:00:00 2001 From: astraw99 Date: Sat, 3 Sep 2022 23:37:59 +0800 Subject: [PATCH] Fix scheduler misc --- pkg/scheduler/internal/cache/cache.go | 2 +- pkg/scheduler/internal/queue/scheduling_queue.go | 3 +-- pkg/scheduler/profile/profile.go | 1 + pkg/scheduler/schedule_one.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/scheduler/internal/cache/cache.go b/pkg/scheduler/internal/cache/cache.go index de7c7f07fcf..670c09042e9 100644 --- a/pkg/scheduler/internal/cache/cache.go +++ b/pkg/scheduler/internal/cache/cache.go @@ -35,7 +35,7 @@ var ( // New returns a Cache implementation. // It automatically starts a go routine that manages expiration of assumed pods. -// "ttl" is how long the assumed pod will get expired. +// "ttl" is how long the assumed pod will get expired, "0" means pod will never expire. // "stop" is the channel that would close the background goroutine. func New(ttl time.Duration, stop <-chan struct{}) Cache { cache := newCache(ttl, cleanAssumedPeriod, stop) diff --git a/pkg/scheduler/internal/queue/scheduling_queue.go b/pkg/scheduler/internal/queue/scheduling_queue.go index 1c989601f28..e6a87906bd7 100644 --- a/pkg/scheduler/internal/queue/scheduling_queue.go +++ b/pkg/scheduler/internal/queue/scheduling_queue.go @@ -447,8 +447,7 @@ func (p *PriorityQueue) flushBackoffQCompleted() { break } pod := rawPodInfo.(*framework.QueuedPodInfo).Pod - boTime := p.getBackoffTime(rawPodInfo.(*framework.QueuedPodInfo)) - if boTime.After(p.clock.Now()) { + if p.isPodBackingoff(rawPodInfo.(*framework.QueuedPodInfo)) { break } _, err := p.podBackoffQ.Pop() diff --git a/pkg/scheduler/profile/profile.go b/pkg/scheduler/profile/profile.go index 64857475402..b023b03f628 100644 --- a/pkg/scheduler/profile/profile.go +++ b/pkg/scheduler/profile/profile.go @@ -98,6 +98,7 @@ func (v *cfgValidator) validate(cfg config.KubeSchedulerProfile, f framework.Fra for _, plCfg := range cfg.PluginConfig { if plCfg.Name == queueSort { queueSortArgs = plCfg.Args + break } } if len(v.queueSort) == 0 { diff --git a/pkg/scheduler/schedule_one.go b/pkg/scheduler/schedule_one.go index 338bb94f37c..1400cd50dda 100644 --- a/pkg/scheduler/schedule_one.go +++ b/pkg/scheduler/schedule_one.go @@ -195,7 +195,7 @@ func (sched *Scheduler) schedulingCycle(ctx context.Context, state *framework.Cy metrics.PodScheduleError(fwk.ProfileName(), metrics.SinceInSeconds(start)) reason = v1.PodReasonSchedulerError } - // One of the plugins returned status different than success or wait. + // One of the plugins returned status different from success or wait. fwk.RunReservePluginsUnreserve(ctx, state, assumedPod, scheduleResult.SuggestedHost) if forgetErr := sched.Cache.ForgetPod(assumedPod); forgetErr != nil { klog.ErrorS(forgetErr, "Scheduler cache ForgetPod failed")