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 62
/
executor.go
76 lines (66 loc) · 2.47 KB
/
executor.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
package interfaces
import (
"context"
"time"
runtime "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
)
//go:generate mockery -name=WorkflowExecutor -output=../mocks/ -case=underscore
type TaskResources struct {
Defaults runtime.TaskResourceSet
Limits runtime.TaskResourceSet
}
type ExecutionParameters struct {
Inputs *core.LiteralMap
AcceptedAt time.Time
Labels map[string]string
Annotations map[string]string
TaskPluginOverrides []*admin.PluginOverride
ExecutionConfig *admin.WorkflowExecutionConfig
SecurityContext *core.SecurityContext
RecoveryExecution *core.WorkflowExecutionIdentifier
TaskResources *TaskResources
EventVersion int
RoleNameKey string
RawOutputDataConfig *admin.RawOutputDataConfig
ClusterAssignment *admin.ClusterAssignment
}
// ExecutionData includes all parameters required to create an execution CRD object.
type ExecutionData struct {
// Execution namespace.
Namespace string
// Execution identifier.
ExecutionID *core.WorkflowExecutionIdentifier
// Underlying workflow name for the execution.
ReferenceWorkflowName string
// Launch plan name used to trigger the execution.
ReferenceLaunchPlanName string
// Compiled workflow closure used to build the flyte workflow
WorkflowClosure *core.CompiledWorkflowClosure
// Additional parameters used to build a workflow execution
ExecutionParameters ExecutionParameters
}
// ExecutionResponse is returned when a Flyte workflow execution is successfully created.
type ExecutionResponse struct {
// Cluster identifier where the execution was created
Cluster string
}
// AbortData includes all parameters required to abort an execution CRD object.
type AbortData struct {
// Execution namespace.
Namespace string
// Execution identifier.
ExecutionID *core.WorkflowExecutionIdentifier
// Cluster identifier where the execution was created
Cluster string
}
// WorkflowExecutor is a client interface used to create and delete Flyte workflow CRD objects.
type WorkflowExecutor interface {
// ID returns the unique name of this executor implementation.
ID() string
// Execute creates a Flyte workflow execution CRD object.
Execute(ctx context.Context, data ExecutionData) (ExecutionResponse, error)
// Abort aborts a running Flyte workflow execution CRD object.
Abort(ctx context.Context, data AbortData) error
}