-
Notifications
You must be signed in to change notification settings - Fork 177
/
serving_kf.go
54 lines (49 loc) · 1.53 KB
/
serving_kf.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package serving
import (
"fmt"
"github.com/kubeflow/arena/pkg/apis/config"
"github.com/kubeflow/arena/pkg/apis/types"
"github.com/kubeflow/arena/pkg/util"
"github.com/kubeflow/arena/pkg/workflow"
log "github.com/sirupsen/logrus"
)
// TensorflowServingProcesser use the default processer
type KFServingProcesser struct {
*processer
}
func NewKFServingProcesser() Processer {
p := &processer{
processerType: types.KFServingJob,
client: config.GetArenaConfiger().GetClientSet(),
enable: true,
useIstioGateway: true,
}
return &KFServingProcesser{
processer: p,
}
}
func SubmitKFServingJob(namespace string, args *types.KFServingArgs) (err error) {
nameWithVersion := fmt.Sprintf("%v-%v", args.Name, args.Version)
args.Namespace = namespace
processers := GetAllProcesser()
processer, ok := processers[args.Type]
if !ok {
return fmt.Errorf("not found processer whose type is %v", args.Type)
}
jobs, err := processer.GetServingJobs(args.Namespace, args.Name, args.Version)
if err != nil {
return err
}
if err := ValidateJobsBeforeSubmiting(jobs, args.Name); err != nil {
return err
}
// the master is also considered as a worker
chart := util.GetChartsFolder() + "/kfserving"
err = workflow.SubmitJob(nameWithVersion, string(types.KFServingJob), namespace, args, chart, args.HelmOptions...)
if err != nil {
return err
}
log.Infof("The Job %s has been submitted successfully", args.Name)
log.Infof("You can run `arena get %s --type %s` to check the job status", args.Name, args.Type)
return nil
}