This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
node_execution.go
86 lines (72 loc) · 3.21 KB
/
node_execution.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package mocks
import (
"context"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
)
type CreateNodeEventFunc func(ctx context.Context, request admin.NodeExecutionEventRequest) (
*admin.NodeExecutionEventResponse, error)
type GetNodeExecutionFunc func(ctx context.Context, request admin.NodeExecutionGetRequest) (*admin.NodeExecution, error)
type ListNodeExecutionsFunc func(
ctx context.Context, request admin.NodeExecutionListRequest) (*admin.NodeExecutionList, error)
type ListNodeExecutionsForTaskFunc func(ctx context.Context, request admin.NodeExecutionForTaskListRequest) (
*admin.NodeExecutionList, error)
type GetNodeExecutionDataFunc func(
ctx context.Context, request admin.NodeExecutionGetDataRequest) (*admin.NodeExecutionGetDataResponse, error)
type MockNodeExecutionManager struct {
createNodeEventFunc CreateNodeEventFunc
getNodeExecutionFunc GetNodeExecutionFunc
listNodeExecutionsFunc ListNodeExecutionsFunc
listNodeExecutionsForTaskFunc ListNodeExecutionsForTaskFunc
getNodeExecutionDataFunc GetNodeExecutionDataFunc
}
func (m *MockNodeExecutionManager) SetCreateNodeEventCallback(createNodeEventFunc CreateNodeEventFunc) {
m.createNodeEventFunc = createNodeEventFunc
}
func (m *MockNodeExecutionManager) CreateNodeEvent(
ctx context.Context,
request admin.NodeExecutionEventRequest) (*admin.NodeExecutionEventResponse, error) {
if m.createNodeEventFunc != nil {
return m.createNodeEventFunc(ctx, request)
}
return nil, nil
}
func (m *MockNodeExecutionManager) SetGetNodeExecutionFunc(getNodeExecutionFunc GetNodeExecutionFunc) {
m.getNodeExecutionFunc = getNodeExecutionFunc
}
func (m *MockNodeExecutionManager) GetNodeExecution(
ctx context.Context, request admin.NodeExecutionGetRequest) (*admin.NodeExecution, error) {
if m.getNodeExecutionFunc != nil {
return m.getNodeExecutionFunc(ctx, request)
}
return nil, nil
}
func (m *MockNodeExecutionManager) SetListNodeExecutionsFunc(listNodeExecutionsFunc ListNodeExecutionsFunc) {
m.listNodeExecutionsFunc = listNodeExecutionsFunc
}
func (m *MockNodeExecutionManager) ListNodeExecutions(
ctx context.Context, request admin.NodeExecutionListRequest) (*admin.NodeExecutionList, error) {
if m.listNodeExecutionsFunc != nil {
return m.listNodeExecutionsFunc(ctx, request)
}
return nil, nil
}
func (m *MockNodeExecutionManager) SetListNodeExecutionsForTaskFunc(listNodeExecutionsForTaskFunc ListNodeExecutionsForTaskFunc) {
m.listNodeExecutionsForTaskFunc = listNodeExecutionsForTaskFunc
}
func (m *MockNodeExecutionManager) ListNodeExecutionsForTask(
ctx context.Context, request admin.NodeExecutionForTaskListRequest) (*admin.NodeExecutionList, error) {
if m.listNodeExecutionsForTaskFunc != nil {
return m.listNodeExecutionsForTaskFunc(ctx, request)
}
return nil, nil
}
func (m *MockNodeExecutionManager) SetGetNodeExecutionDataFunc(getNodeExecutionDataFunc GetNodeExecutionDataFunc) {
m.getNodeExecutionDataFunc = getNodeExecutionDataFunc
}
func (m *MockNodeExecutionManager) GetNodeExecutionData(
ctx context.Context, request admin.NodeExecutionGetDataRequest) (*admin.NodeExecutionGetDataResponse, error) {
if m.getNodeExecutionDataFunc != nil {
return m.getNodeExecutionDataFunc(ctx, request)
}
return nil, nil
}