-
Notifications
You must be signed in to change notification settings - Fork 543
/
tasks.go
40 lines (31 loc) · 849 Bytes
/
tasks.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
package v1alpha1
import (
"bytes"
"github.com/golang/protobuf/jsonpb"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
)
type TaskSpec struct {
*core.TaskTemplate
}
func (in *TaskSpec) TaskType() TaskType {
return in.Type
}
func (in *TaskSpec) CoreTask() *core.TaskTemplate {
return in.TaskTemplate
}
func (in *TaskSpec) DeepCopyInto(out *TaskSpec) {
*out = *in
// We do not manipulate the object, so its ok
// Once we figure out the autogenerate story we can replace this
}
func (in *TaskSpec) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
if err := marshaler.Marshal(&buf, in.TaskTemplate); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func (in *TaskSpec) UnmarshalJSON(b []byte) error {
in.TaskTemplate = &core.TaskTemplate{}
return jsonpb.Unmarshal(bytes.NewReader(b), in.TaskTemplate)
}