Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions cmd/kperf/commands/runnergroup/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ var runCommand = cli.Command{
Name: "affinity",
Usage: "Deploy server to the node with a specific labels (FORMAT: KEY=VALUE[,VALUE])",
},
cli.IntFlag{
Name: "runner-verbosity",
Usage: "The verbosity level of runners",
Value: 2,
},
},
Action: func(cliCtx *cli.Context) error {
imgRef := cliCtx.String("runner-image")
Expand Down Expand Up @@ -76,6 +81,7 @@ var runCommand = cli.Command{
kubeCfgPath,
imgRef,
specs[0],
cliCtx.Int("runner-verbosity"),
runner.WithRunCmdServerNodeSelectorsOpt(affinityLabels),
runner.WithRunCmdRunnerGroupFlowControl(priorityLevel, matchingPrecedence),
)
Expand Down
8 changes: 7 additions & 1 deletion cmd/kperf/commands/runnergroup/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ var serverCommand = cli.Command{
Usage: "The runner result should be stored in that path",
Required: true,
},
cli.IntFlag{
Name: "runner-verbosity",
Usage: "The verbosity level of runners",
Value: 2,
},
},
Hidden: true,
Action: func(cliCtx *cli.Context) error {
Expand Down Expand Up @@ -90,6 +95,7 @@ func buildRunnerGroupHandlers(cliCtx *cli.Context, serverName string) ([]*runner
specURIs := cliCtx.StringSlice("runnergroup")
imgRef := cliCtx.String("runner-image")
namespace := cliCtx.String("namespace")
runnerVerbosity := cliCtx.Int("runner-verbosity")

ownerRef := ""
if cliCtx.IsSet("runner-owner") {
Expand Down Expand Up @@ -117,7 +123,7 @@ func buildRunnerGroupHandlers(cliCtx *cli.Context, serverName string) ([]*runner
}

groupName := fmt.Sprintf("%s-%d", serverName, idx)
g, err := runnergroup.NewHandler(clientset, namespace, groupName, spec, imgRef)
g, err := runnergroup.NewHandler(clientset, namespace, groupName, spec, imgRef, runnerVerbosity)
if err != nil {
return nil, err
}
Expand Down
2 changes: 2 additions & 0 deletions manifests/runnergroup/server/templates/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ spec:
- v1:Pod:$(POD_NAME):$(POD_UID)
- --runner-sa
- {{ .Values.name }}
- --runner-verbosity
- {{ .Values.runnerVerbosity }}
- --address
- $(POD_IP):8080
- --address
Expand Down
1 change: 1 addition & 0 deletions manifests/runnergroup/server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: ""
image: ""
# TODO(weifu): need https://github.com/Azure/kperf/issues/25 to support list
runnerGroupSpec: ""
runnerVerbosity: "2"
nodeSelectors: {}
flowcontrol:
priorityLevelConfiguration: workload-low
Expand Down
18 changes: 12 additions & 6 deletions runner/group/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"reflect"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -45,6 +46,8 @@ type Handler struct {
imageRef string

clientset kubernetes.Interface

runnerVerbosity int
}

// NewHandler returns new instance of Handler.
Expand All @@ -53,19 +56,21 @@ func NewHandler(
namespace, name string,
spec *types.RunnerGroupSpec,
imageRef string,
runnerVerbosity int,
) (*Handler, error) {
ownRef, err := buildOwnerReference(spec.OwnerReference)
if err != nil {
return nil, err
}

return &Handler{
name: name,
namespace: namespace,
spec: spec,
ownerRef: ownRef,
imageRef: imageRef,
clientset: clientset,
name: name,
namespace: namespace,
spec: spec,
ownerRef: ownRef,
imageRef: imageRef,
clientset: clientset,
runnerVerbosity: runnerVerbosity,
}, nil
}

Expand Down Expand Up @@ -417,6 +422,7 @@ func (h *Handler) buildBatchJobObject(uploadURL string) *batchv1.Job {
},
Command: []string{
"/run_runner.sh",
strconv.Itoa(h.runnerVerbosity),
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions runner/runnergroup_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func CreateRunnerGroupServer(ctx context.Context,
kubeconfigPath string,
runnerImage string,
rgSpec *types.RunnerGroupSpec,
runnerVerbosity int,
opts ...RunCmdOpt,
) error {
specInStr, err := tweakAndMarshalSpec(rgSpec)
Expand Down Expand Up @@ -78,6 +79,8 @@ func CreateRunnerGroupServer(ctx context.Context,
"name="+runnerGroupServerReleaseName,
"image="+runnerImage,
"runnerGroupSpec="+specInStr,
// runnerVerbosity needs to be surrounded by quotes, so that YAML parse it as a string.
fmt.Sprintf("runnerVerbosity=\"%d\"", runnerVerbosity),
),
appiler,
)
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ set -euo pipefail

result_file=/data/${POD_NAMESPACE}-${POD_NAME}-${POD_UID}.json

/kperf -v=2 runner run --config=/config/load_profile.yaml \
--user-agent=${POD_NAME} \
/kperf -v=$1 runner run --config=/config/load_profile.yaml \
--user-agent=${POD_NAME} \
--result=${result_file} \
--raw-data

Expand Down
Loading