Skip to content

Commit

Permalink
Fix scheduler plugin arguments readin bug.
Browse files Browse the repository at this point in the history
Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
  • Loading branch information
jiangkaihua committed Oct 18, 2022
1 parent 59e58c2 commit 1de3e11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/scheduler/framework/arguments.go
Expand Up @@ -58,6 +58,10 @@ func (a Arguments) GetFloat64(ptr *float64, key string) {

value, ok := argv.(float64)
if !ok {
if intVal, ok := argv.(int); ok {
*ptr = float64(intVal)
return
}
klog.Warningf("Could not parse argument: %v for key %s to float64", argv, key)
return
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/scheduler/framework/arguments_test.go
Expand Up @@ -116,6 +116,15 @@ func TestArgumentsGetFloat64(t *testing.T) {
baseValue: 1.2,
expectValue: 1.2,
},
{
name: "int value",
arg: Arguments{
key1: 15,
},
key: key1,
baseValue: 1.2,
expectValue: 15,
},
}

for index, c := range cases {
Expand Down

0 comments on commit 1de3e11

Please sign in to comment.