Skip to content

Commit

Permalink
Merge pull request volcano-sh#12 from TommyLike/opt/cleanup_codes
Browse files Browse the repository at this point in the history
Cleanup unused codes
  • Loading branch information
volcano-sh-bot committed May 15, 2019
2 parents 6f00bdb + 4ea7282 commit 9f4bc07
Showing 1 changed file with 2 additions and 14 deletions.
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
}

0 comments on commit 9f4bc07

Please sign in to comment.