forked from kubeflow/arena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job.go
46 lines (37 loc) · 768 Bytes
/
job.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
package serving
import (
"github.com/kubeflow/arena/pkg/apis/types"
)
type baseJob struct {
name string
jobType string
args interface{}
}
func newBaseJob(name string, jobType string, args interface{}) baseJob {
return baseJob{
name: name,
jobType: jobType,
args: args,
}
}
func (b *baseJob) Name() string {
return b.name
}
func (b *baseJob) Type() string {
return b.jobType
}
func (b *baseJob) Args() interface{} {
return b.args
}
// Job defines the base job
type Job struct {
baseJob
}
func NewJob(name string, jobType types.ServingJobType, args interface{}) *Job {
return &Job{
baseJob: newBaseJob(name, string(jobType), args),
}
}
func (j *Job) Type() types.ServingJobType {
return types.ServingJobType(j.baseJob.Type())
}