Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxuzhonghu committed Jul 6, 2020
1 parent 2328308 commit c8052c4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
3 changes: 2 additions & 1 deletion pkg/scheduler/api/node_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ func (ni *NodeInfo) setNodeGPUInfo(node *v1.Node) {
}
gpuNumber := res.Value()
if gpuNumber == 0 {
klog.Warningf("invalid %s=%s", VolcanoGPUNumber, res)
klog.Warningf("invalid %s=%s", VolcanoGPUNumber, res.String())
return
}

memoryPerCard := uint(totalMemory / gpuNumber)
Expand Down
3 changes: 3 additions & 0 deletions pkg/scheduler/api/node_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestNodeInfo_AddPod(t *testing.T) {
"c1/p1": NewTaskInfo(case01Pod1),
"c1/p2": NewTaskInfo(case01Pod2),
},
GPUDevices: make(map[int]*GPUDevice),
},
},
{
Expand All @@ -79,6 +80,7 @@ func TestNodeInfo_AddPod(t *testing.T) {
Capability: buildResource("2000m", "1G"),
State: NodeState{Phase: Ready},
Tasks: map[TaskID]*TaskInfo{},
GPUDevices: make(map[int]*GPUDevice),
},
expectedFailure: true,
},
Expand Down Expand Up @@ -138,6 +140,7 @@ func TestNodeInfo_RemovePod(t *testing.T) {
"c1/p1": NewTaskInfo(case01Pod1),
"c1/p3": NewTaskInfo(case01Pod3),
},
GPUDevices: make(map[int]*GPUDevice),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/api/pod_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func GetGPUIndex(pod *v1.Pod) int {
if found {
id, err := strconv.Atoi(value)
if err != nil {
klog.Error("invalid %s=%s", GPUIndex, value)
klog.Errorf("invalid %s=%s", GPUIndex, value)
return -1
}
return id
Expand Down
32 changes: 4 additions & 28 deletions pkg/scheduler/plugins/predicates/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ const (
// PluginName indicates name of volcano scheduler plugin.
PluginName = "predicates"

// MemoryPressurePredicate is the key for enabling Memory Pressure Predicate in YAML
MemoryPressurePredicate = "predicate.MemoryPressureEnable"
// DiskPressurePredicate is the key for enabling Disk Pressure Predicate in YAML
DiskPressurePredicate = "predicate.DiskPressureEnable"
// PIDPressurePredicate is the key for enabling PID Pressure Predicate in YAML
PIDPressurePredicate = "predicate.PIDPressureEnable"
// GPUSharingPredicate is the key for enabling GPU Sharing Predicate in YAML
GPUSharingPredicate = "predicate.GPUSharingEnable"
)
Expand All @@ -65,17 +59,14 @@ func (pp *predicatesPlugin) Name() string {
}

type predicateEnable struct {
memoryPressureEnable bool
diskPressureEnable bool
pidPressureEnable bool
gpuSharingEnable bool
gpuSharingEnable bool
}

func enablePredicate(args framework.Arguments) predicateEnable {

/*
User Should give predicatesEnable in this format(predicate.MemoryPressureEnable, predicate.DiskPressureEnable, predicate.PIDPressureEnable, predicate.GPUSharingEnable.
Currently supported only for MemoryPressure, DiskPressure, PIDPressure predicate checks.
User Should give predicatesEnable in this format(predicate.GPUSharingEnable).
Currently supported only GPUSharing predicate checks.
actions: "reclaim, allocate, backfill, preempt"
tiers:
Expand All @@ -87,30 +78,15 @@ func enablePredicate(args framework.Arguments) predicateEnable {
- name: drf
- name: predicates
arguments:
predicate.MemoryPressureEnable: true
predicate.DiskPressureEnable: true
predicate.PIDPressureEnable: true
predicate.GPUSharingEnable: true
- name: proportion
- name: nodeorder
*/

predicate := predicateEnable{
memoryPressureEnable: false,
diskPressureEnable: false,
pidPressureEnable: false,
gpuSharingEnable: true, // enable for debug
gpuSharingEnable: false,
}

// Checks whether predicate.MemoryPressureEnable is provided or not, if given, modifies the value in predicateEnable struct.
args.GetBool(&predicate.memoryPressureEnable, MemoryPressurePredicate)

// Checks whether predicate.DiskPressureEnable is provided or not, if given, modifies the value in predicateEnable struct.
args.GetBool(&predicate.diskPressureEnable, DiskPressurePredicate)

// Checks whether predicate.PIDPressureEnable is provided or not, if given, modifies the value in predicateEnable struct.
args.GetBool(&predicate.pidPressureEnable, PIDPressurePredicate)

// Checks whether predicate.GPUSharingEnable is provided or not, if given, modifies the value in predicateEnable struct.
args.GetBool(&predicate.gpuSharingEnable, GPUSharingPredicate)

Expand Down

0 comments on commit c8052c4

Please sign in to comment.