Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logic that remembers previous pool state #3954

Merged
merged 2 commits into from
Sep 19, 2024
Merged
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
20 changes: 5 additions & 15 deletions internal/scheduler/scheduling_algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ type FairSchedulingAlgo struct {
limiterByQueue map[string]*rate.Limiter
// Max amount of time each scheduling round is allowed to take.
maxSchedulingDuration time.Duration
// Pools that need to be scheduled in sorted order
poolsToSchedule []string
clock clock.Clock
resourceListFactory *internaltypes.ResourceListFactory
floatingResourceTypes *floatingresources.FloatingResourceTypes
Expand Down Expand Up @@ -117,23 +115,18 @@ func (l *FairSchedulingAlgo) Schedule(
return nil, err
}

if len(l.poolsToSchedule) == 0 {
// Cycle over groups in a consistent order.
l.poolsToSchedule = maps.Keys(fsctx.nodesByPoolAndExecutor)
sortGroups(l.poolsToSchedule, l.schedulingConfig.PoolSchedulePriority, l.schedulingConfig.DefaultPoolSchedulePriority)
}
pools := maps.Keys(fsctx.nodesByPoolAndExecutor)
sortGroups(pools, l.schedulingConfig.PoolSchedulePriority, l.schedulingConfig.DefaultPoolSchedulePriority)

ctx.Infof("Looping over pools %s", strings.Join(l.poolsToSchedule, " "))
for len(l.poolsToSchedule) > 0 {
ctx.Infof("Looping over pools %s", strings.Join(pools, " "))
for _, pool := range pools {
select {
case <-ctx.Done():
// We've reached the scheduling time limit; exit gracefully.
ctx.Info("ending scheduling round early as we have hit the maximum scheduling duration")
return overallSchedulerResult, nil
default:
}
pool := armadaslices.Pop(&l.poolsToSchedule)

nodeCountForPool := 0
for _, executor := range fsctx.executors {
nodeCountForPool += len(fsctx.nodesByPoolAndExecutor[pool][executor.Id])
Expand Down Expand Up @@ -162,11 +155,8 @@ func (l *FairSchedulingAlgo) Schedule(
err,
)

if err == context.DeadlineExceeded {
if errors.Is(err, context.DeadlineExceeded) {
// We've reached the scheduling time limit;
// add the executorGroupLabel back to l.poolsToSchedule such that we try it again next time,
// and exit gracefully.
l.poolsToSchedule = append(l.poolsToSchedule, pool)
ctx.Info("stopped scheduling early as we have hit the maximum scheduling duration")
break
} else if err != nil {
Expand Down