Skip to content
This repository has been archived by the owner on Jul 7, 2019. It is now read-only.

Cleanup unused codes #12

Merged
merged 1 commit into from
May 15, 2019
Merged
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
1 change: 0 additions & 1 deletion hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ pkg/scheduler/actions/backfill
pkg/scheduler/actions/enqueue
pkg/scheduler/actions/preempt
pkg/scheduler/actions/reclaim
pkg/scheduler/api
test/e2e
16 changes: 2 additions & 14 deletions pkg/scheduler/api/resource_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"fmt"
"math"

"k8s.io/apimachinery/pkg/api/resource"

v1 "k8s.io/api/core/v1"
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
)
Expand Down Expand Up @@ -83,6 +81,7 @@ func NewResource(rl v1.ResourceList) *Resource {
case v1.ResourcePods:
r.MaxTaskNum += int(rQuant.Value())
default:
//NOTE: When converting this back to k8s resource, we need record the format as well as / 1000
if v1helper.IsScalarResourceName(rName) {
r.AddScalar(rName, float64(rQuant.MilliValue()))
}
Expand Down Expand Up @@ -157,7 +156,7 @@ func (r *Resource) Sub(rr *Resource) *Resource {
return r
}

panic(fmt.Errorf("Resource is not sufficient to do operation: <%v> sub <%v>",
panic(fmt.Errorf("resource is not sufficient to do operation: <%v> sub <%v>",
r, rr))
}

Expand Down Expand Up @@ -326,14 +325,3 @@ func (r *Resource) SetScalar(name v1.ResourceName, quantity float64) {
}
r.ScalarResources[name] = quantity
}

func (r *Resource) Convert2K8sResource() *v1.ResourceList {
list := v1.ResourceList{
v1.ResourceCPU: *resource.NewMilliQuantity(int64(r.MilliCPU), resource.DecimalSI),
v1.ResourceMemory: *resource.NewQuantity(int64(r.Memory), resource.BinarySI),
}
for name, value := range r.ScalarResources {
list[name] = *resource.NewQuantity(int64(value), resource.BinarySI)
}
return &list
}