forked from kubeflow/arena
/
submit_benchmark.go
28 lines (24 loc) · 983 Bytes
/
submit_benchmark.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package model
import (
"fmt"
"github.com/kubeflow/arena/pkg/apis/types"
"github.com/kubeflow/arena/pkg/util"
"github.com/kubeflow/arena/pkg/workflow"
log "github.com/sirupsen/logrus"
)
func SubmitModelBenchmarkJob(namespace string, args *types.ModelBenchmarkArgs) error {
args.Namespace = namespace
if args.Command == "" {
args.Command = fmt.Sprintf("python easy_inference/main.py benchmark --model-config-file=%s "+
"--report-path=%s --concurrency=%d --requests=%d --duration=%d",
args.ModelConfigFile, args.ReportPath, args.Concurrency, args.Requests, args.Duration)
}
modelJobChart := util.GetChartsFolder() + "/modeljob"
err := workflow.SubmitJob(args.Name, string(types.ModelBenchmarkJob), namespace, args, modelJobChart, args.HelmOptions...)
if err != nil {
return err
}
log.Infof("The model benchmark job %s has been submitted successfully", args.Name)
log.Infof("You can run `arena model get %s` to check the job status", args.Name)
return nil
}