Skip to content

Commit

Permalink
contrib: fix args issue
Browse files Browse the repository at this point in the history
We should not render args if input is empty.

Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
fuweid committed Mar 29, 2024
1 parent 3c6e3c6 commit d411f91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contrib/cmd/runkperf/commands/bench/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/Azure/kperf/api/types"
kperfcmdutils "github.com/Azure/kperf/cmd/kperf/commands/utils"
"github.com/Azure/kperf/contrib/internal/manifests"
"github.com/Azure/kperf/contrib/internal/utils"
"github.com/Azure/kperf/manifests"
"k8s.io/klog/v2"

"github.com/urfave/cli"
Expand Down
12 changes: 9 additions & 3 deletions contrib/internal/utils/kperf_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ func (kr *KperfRunner) NewNodepool(
fmt.Sprintf("--cpu=%v", 32),
fmt.Sprintf("--memory=%v", 96),
fmt.Sprintf("--max-pods=%v", maxPods),
fmt.Sprintf("--affinity=%v", affinity),
fmt.Sprintf("--shared-provider-id=%v", sharedProviderID),
)
if affinity != "" {
args = append(args, fmt.Sprintf("--affinity=%v", affinity))
}
if sharedProviderID != "" {
args = append(args, fmt.Sprintf("--shared-provider-id=%v", sharedProviderID))
}

_, err := runCommand(ctx, timeout, "kperf", args)
return err
Expand All @@ -65,8 +69,10 @@ func (kr *KperfRunner) RGRun(ctx context.Context, timeout time.Duration, rgCfgPa
args = append(args, "run",
fmt.Sprintf("--runnergroup=file://%v", rgCfgPath),
fmt.Sprintf("--runner-image=%v", kr.runnerImage),
fmt.Sprintf("--affinity=%v", affinity),
)
if affinity != "" {
args = append(args, fmt.Sprintf("--affinity=%v", affinity))
}
if flowcontrol != "" {
args = append(args, fmt.Sprintf("--runner-flowcontrol=%v", flowcontrol))
}
Expand Down

0 comments on commit d411f91

Please sign in to comment.