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

[WIP] support rescheduling based on realtime performance #2092

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion docs/design/drf.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This share value is used for job ordering and task premption.


##### 1.1 Gang Scheduling with DRF in job ordering ( Gang -> DRF)
Gang scheduling sorts the job based on whether the job has atleast **minAvailable** task already (allocated + successfully completed + pipelined) or not.
Gang scheduling sorts the job based on whether the job has at least **minAvailable** task already (allocated + successfully completed + pipelined) or not.
Jobs which has not met the minAvailable criteria has higher priority than jobs which has met
the minAvailable criteria.

Expand Down
76 changes: 76 additions & 0 deletions pkg/scheduler/actions/shuffle/shuffle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
Copyright 2022 The Volcano Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package shuffle

import (
"k8s.io/klog"
"volcano.sh/volcano/pkg/scheduler/api"
"volcano.sh/volcano/pkg/scheduler/framework"
)

const (
Strategies = "strategies"
Shuffle = "shuffle"
)

// Action defines the action
type Action struct{}

// New returns the action instance
func New() *Action {
return &Action{}
}

// Name returns the action name
func (alloc *Action) Name() string {
return Shuffle
}

// Initialize inits the action
func (alloc *Action) Initialize() {}

// Execute select evictees according given strategies and evict them.
func (alloc *Action) Execute(ssn *framework.Session) {
klog.V(3).Infof("Enter Shuffle ...\n")
defer klog.V(3).Infof("Leaving Shuffle ...\n")

// select pods that may be evicted
tasks := make([]*api.TaskInfo, 0)
for _, jobInfo := range ssn.Jobs {
for _, taskInfo := range jobInfo.Tasks {
if taskInfo.Status == api.Running {
tasks = append(tasks, taskInfo)
}
}
}
for _, task := range tasks {
Copy link
Member

@k82cn k82cn Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's check log level before go through all tasks to improve the performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable. Let me change the level to v5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

klog.V(4).Infof("Running tasks %s: [ns: %s, job: %s]\n", task.Name, task.Namespace, task.Job)
}

// Evict target workloads
victims := ssn.Victims(tasks)
for victim := range victims {
klog.V(5).Infof("Victim %s: [ns: %s, job: %s]\n", victim.Name, victim.Namespace, victim.Job)
if err := ssn.Evict(victim, "shuffle"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have a const value for "shuffle".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

klog.Errorf("Failed to evict Task <%s/%s>: %v", victim.Namespace, victim.Name, err)
continue
}
}
}

// UnInitialize releases resource which are not useful.
func (alloc *Action) UnInitialize() {}
Loading