-
Notifications
You must be signed in to change notification settings - Fork 963
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
Changes from all commits
bd29091
f23314b
f864c2e
c06a0ea
0e44e57
12b5ca7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 { | ||
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's have a const value for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm OK about that. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() {} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved